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

James Lu jamtlu at gmail.com
Wed Nov 13 15:25:46 UTC 2019

On Wednesday, 13 November 2019 at 15:19:38 UTC, Gregor Mückl 
> 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.
> [...]

We could add @nogc types. That indicates to the implementation
that the memory held by that type MAY be ignored by the GC and 
that any pointers held in that type MUST NOT be moved by a moving

Alternatively, "special" pointers could have a .toPointer function
that converts itself into the memory address they mean. 
include XOR pointers.

More information about the Digitalmars-d mailing list