Want reasonable reference counting? Disable automatic sharing of immutable

IGotD- nise at nise.com
Mon Nov 15 14:51:43 UTC 2021


On Monday, 15 November 2021 at 14:27:29 UTC, deadalnix wrote:
> On Monday, 15 November 2021 at 12:24:33 UTC, Timon Gehr wrote:
>> On 15.11.21 11:36, rikki cattermole wrote:
>>> 
>>> On 15/11/2021 10:28 PM, Danni Coy wrote:
>>>> that feels like a single object from a user perspective?
>>> 
>>> The most important thing about this is: it'll all be in 
>>> continuous memory.
>>> 
>>> Perfect for all of your crashing needs due to read only 
>>> memory!
>>
>> Whoever allocates the object knows the memory layout and can 
>> put it in writable memory.
>
> If the object is allocated, it HAS TO BE in mutable memory.

Yes, I thought this discussion was a little bit strange, maybe 
because my lack of knowledge. However, if an object is allocated 
in the heap it has be in mutable memory.

Keep in mind that doesn't need to be the same has the type 
designation, immutable might be in RAM. Anyway, we can cast 
modify constants that are heap allocated. How does the compiler 
know that something is allocated on the heap?

We're still discussing around the main issue which is fixing the 
type system so that managed memory pointers has a distinctive 
type.


More information about the Digitalmars-d mailing list