Helping with __mutable (which will be renamed to __metadata)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Apr 13 00:45:07 UTC 2019


Razvan Nitu is working on the DIP initiated by Timon Gehr, known 
colloquially as the one that introduces __mutable - i.e. a mechanism for 
allowing controlled changes to immutable data. Here's a draft:

https://github.com/RazvanN7/DIPs/blob/Mutable_Dip/DIPs/DIP1xxx-rn.md

We figured that we're dealing a misnomer - we don't want __mutable, but 
instead __metadata - information that is nominally part of the object 
but needs certain leeway from the type system. Typical use cases are:

* reference counting of immutable data structures
* caching
* lazy evaluation

We got stuck at the interaction of __mutable with const parent objects 
(unclear whether the parent object originated as immutable or 
unqualified), and how pure functions should deal with __mutable. The few 
solutions we are toying with are either incomplete or too complicated 
(or both).

The help of a few PL and compiler specialists would be very valuable 
here. I'm cc'ing a few, if anyone wants to help please let us know.


More information about the Digitalmars-d mailing list