Head Const

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 18 07:19:59 PST 2016


On Thursday, 18 February 2016 at 14:58:00 UTC, ixid wrote:
> Is it not possible to have two objects, the data and the 
> information about the data? It seems like a mistake to try to

Not if the immutability is transitive. But "struct" isn't really 
an object, it is a chunk of memory. Often an object is 
represented as a chunk of memory... sometimes multiple objects 
are represented in the same chunk of memory for efficiency. 
Sometimes an object is distributed over many chunks of memory...

Say, if you model a person using a chat service. You might want 
only one context to have full write access, but all context to 
have access to an "is busy" field.

No point in putting "is busy" in a different memory chunk.



More information about the Digitalmars-d mailing list