GC/non-GC memory as part of data type?

Gregor Mückl gregormueckl at gmx.de
Thu Nov 14 18:56:45 UTC 2019


On Thursday, 14 November 2019 at 14:01:50 UTC, Patrick Schluter 
wrote:
> On Wednesday, 13 November 2019 at 15:19:38 UTC, Gregor Mückl 
> wrote:
>> Hi!
>>
>> This is an attempt to follow up on the DIP1025 discussion: 
>> what happens if all pointers/arrays/references carry the 
>> origin of the pointed to memory region as part of their type? 
>> The goal is to have a cleaner, more explicit separation of GC 
>> and non-GC heaps.
>>
>> [...]
>
> In fact, it's more or less just const/immutability for the 
> pointer, isn't it?

No, const is different from what I'm trying to describe. You can 
currently get a const pointer to GC allocated memory and still 
pass that to free(), for example. If there were a distinction 
between native and GC pointers, this would be impossible without 
an explicit, unsafe cast.


More information about the Digitalmars-d mailing list