dhh1128 / intent

the intent formal language
https://intentlang.org
2 stars 1 forks source link

support "value classes" (simple POD), possibly like C# does #103

Open dhh1128 opened 9 years ago

dhh1128 commented 9 years ago

See http://www.two-sdg.demon.co.uk/curbralan/papers/ValuedConversions.pdf

An important quote from the article:

Values are strongly informational objects for which identity is not significant; i.e., the focus is principally on their state content and any behavior organized around that. An- other distinguishing feature of values is their granularity: They are typically fine-grained objects, representing simple concepts in the system such as quantities.6 In C++, values are associated with an idiomatic set of capa- bilities and conventions. The emphasis of a value lies in its state, not its identity. Thus values can be copied and typically assigned one to another, requiring the explicit or implicit definition of a public copy constructor and public assignment operator. Val- ues typically live within other scopes, i.e., within objects or blocks, rather than on the heap. Values are therefore normally passed around and manipulated directly as variables or through references, but not as pointers that emphasize identity and in- direction. As a consequence of this immediacy, indirection trans- parency, and granularity, operator overloading and conversions often make sense for value classes whereas they do not for more granular, heap-based objects manipulated through pointers.