You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
An optional field of an @obj external is evaluated after the fields that follow it #9225
An optional labeled argument of an @obj external whose presence is not known at compile time is evaluated after all the other fields, so the arguments do not run in source order:
Lam_compile_external_obj.assemble_obj_args (compiler/core/lam_compile_external_obj.ml) puts an optional argument whose presence is not known into a list of assignments and builds the object literal from the other fields first. Each deferred argument is then bound to a variable by Js_ast_util.named_expression and assigned under an if, after every field of the literal has been evaluated. A comment in the same function says that the evaluation order is undefined.
Since #9217, a polymorphic variant field gets a temporary before the object is built, so make(~level=?level(), ~mode=mode(), ()) with ~level: @int [#low | #high]=? runs in order. Other optional fields do not.
Activity