Weird rule for immutable

Walter Bright newshound2 at digitalmars.com
Sun Apr 12 20:36:11 UTC 2020


On 4/11/2020 7:26 PM, Timon Gehr wrote:
> According to spec I think it's invalid, therefore it is impossible to manually 
> manage immutable memory. I think the specification should rather be something 
> along the lines that it is undefined behavior to read different values using the 
> same (logical) reference to immutable data.

I've made a start on defining lifetimes in the spec, but it's hard to turn "I 
know what I mean" into legalese.

I also wish to carefully avoid crafting semantics that require Data Flow 
Analysis to implement. It does turn out to be necessary to do DFA for @live, but 
at least that's optional.

This is why, for example, the language uses lexical closures to determine where 
to insert destructors rather than "last use".


More information about the Digitalmars-d mailing list