ballerina-platform / ballerina-spec

Ballerina Language and Platform Specifications
Other
167 stars 53 forks source link

Immutable structures without storage identity #338

Open jclark opened 5 years ago

jclark commented 5 years ago

Issue #282 is a special case of a more general problem. It is sometimes useful to be able to have structures (both lists and mappings) with pure value semantics. As well as being immutable, they do not have identity distinct from the identity of their members; two such structures are === if their members are ===.

This relates to #47. We want to be able to have structures e.g. for dates and times, that are mapped onto a database engine's native datatypes. But these native datatypes have value semantics.

It also relates to #189.

jclark commented 4 years ago

There is now a public proposal.

jclark commented 4 years ago

The immutability proposal solves this problem by saying that the construction of read-only types should do interning construction, which effectively means that read-only types do not have storage identity.