the following type is specified
type Foo = { foo: string; bar: int };;
and the following code quote
<@fun v x -> { x with foo = v; bar = 99 } @>;;
this will lead to
val it : Quotations.Expr<(string -> Foo -> Foo)> =
Lambda (v, Lambda (x, NewRecord (Foo, v, Value (99))))
Expected. Also the following code quote
<@fun v x -> { x with bar = v;foo = "foo" } @>;;
gives the expected result.
val it : Quotations.Expr<(int -> Foo -> Foo)> =
Lambda (v, Lambda (x, NewRecord (Foo, Value ("foo"), v)))
However, this (reordering and assigning a value to the second field)
<@fun v x -> { x with bar = 66;foo = v } @>;;
gives
val it : Quotations.Expr<(string -> Foo -> Foo)> =
Lambda (v, Lambda (x, Let (bar, Value (66), NewRecord (Foo, v, bar))))
a let. But not in the code let. Why is this?