given the following type
type Foo = { foo: string; bar: int };;
and the following code quotation
<@fun v x -> { x with foo = v; bar = 99 } @>;;
this will result in
val it : Quotations.Expr<(string -> Foo -> Foo)> =
Lambda (v, Lambda (x, NewRecord (Foo, v, Value (99))))
Which is expected. Also the following code quotation
<@fun v x -> { x with bar = v;foo = "foo" } @>;;
yields the expected result.
val it : Quotations.Expr<(int -> Foo -> Foo)> =
Lambda (v, Lambda (x, NewRecord (Foo, Value ("foo"), v)))
However this (changing the order and assigning the value to the second field)
<@fun v x -> { x with bar = 66;foo = v } @>;;
yields
val it : Quotations.Expr<(string -> Foo -> Foo)> =
Lambda (v, Lambda (x, Let (bar, Value (66), NewRecord (Foo, v, bar))))
a let
. But there is no let
in the code. Why is this?