getting rid of immutable (or const)

berni someone at somewhere.com
Thu Sep 5 14:31:33 UTC 2019


On Thursday, 5 September 2019 at 13:27:55 UTC, drug wrote:
> [...]when you put it into an AA you modify old value

Why?!? :-o When putting it into an AA it will be copied to a 
different place in memory, but the value is still the same, it's 
not modified. Sorry, but I still think, there is something 
fundamentally wrong about how I think about immutability.

> But if you just want to initialize an AA by immutable members 
> then this can be usefull to read 
> https://dlang.org/spec/hash-map.html#runtime_initialization

Well, yes and no. I want to initialize an AA with structs that 
contain immutable members. And that AA resides at runtime inside 
of a function body. I don't see, how this can be done with he 
approach given by the link. :-(


More information about the Digitalmars-d-learn mailing list