By ref and by pointer kills performance.

FeepingCreature feepingcreature at gmail.com
Sun Feb 18 13:41:42 UTC 2024


On Friday, 16 February 2024 at 15:12:58 UTC, Kagamin wrote:
> On Friday, 16 February 2024 at 11:10:13 UTC, Richard (Rikki) 
> Andrew Cattermole wrote:
>> Immutable objects can be in read only memory, since nothing is 
>> allowed to modify the contents process wide.
>
> Then you won't be able to create a monitor for them.

I don't get this point. The monitor field can just be the single 
pointer that is not transitively immutable? I mean. The compiler 
knows *exactly* when you access the monitor field. It's never 
accessed manually! This is a pointer access that can be generated 
at exactly line of code in the compiler. Just drop immutable 
there.


More information about the Digitalmars-d mailing list