daml/daml-lf/spec
Sofia Faro 3429ec24cc
Normalize struct field order in the LF spec. (#7228)
* Normalize struct field order in the LF spec.

This commit changes the LF spec to ensure that struct field order is ignored whenever reasonable.

* Rename "type synonym resolution" to "type normalization", and change the rule for structs to also normalize the order of fields.

* Make the struct type "well-formed" only if the struct fields are sorted by field name. (This matches the way "well-formed" is only used for normalized types. E.g. type synonyms are not considered "well-formed" by the spec. This nomenclature should possibly be fixed in a separate PR.)

* Change the struct con expression type rule accordingly.

* Change the definition of a struct value. A struct value is now a struct expression where all the field expressions are values, and all the field names are sorted.

* Change the evaluation rule for struct expressions to also sort the fields by field name in the process.

As far as I know, this spec matches the behavior of the LF engine. I also tried to make the treatment of struct field order in the types match the treatment of struct field order in expressions (i.e. normalized structs always have sorted fields, but non-normalized structs do not).

changelog_begin
changelog_end

* Apply suggestions from code review

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Update daml-lf/spec/daml-lf-1.rst

Co-authored-by: Remy <remy.haemmerle@daml.com>
2020-08-25 14:32:03 +00:00
..
contract-id.rst LF: typo in contract ID specification (#6316) 2020-06-12 11:00:57 +00:00
daml-lf-1.rst Normalize struct field order in the LF spec. (#7228) 2020-08-25 14:32:03 +00:00
transaction.rst replace DAML Authors with DA in copyright headers (#5228) 2020-03-27 01:26:10 +01:00
value.rst replace DAML Authors with DA in copyright headers (#5228) 2020-03-27 01:26:10 +01:00