D is our last hope

Walter Bright newshound2 at digitalmars.com
Mon Dec 18 20:14:55 UTC 2023


On 12/18/2023 3:12 AM, IGotD- wrote:
> Have you ever thought about keeping the raw pointers as they are. Classes are 
> references types that are allocated using GC. Structs are value types that 
> cannot directly be allocated using GC. If you want to allocate a struct using GC 
> they need to be encapsulated in a GC object. Manual heap allocation are entirely 
> done with raw pointers as before.
> 
> This is essentially what Swift does, classes are references types that are 
> allocated using GC and structs are value types that you cannot directly allocate 
> on the heap or GC on its own.
> 
> This change is breaking change but can be done. A few standard library types 
> must be rewritten though but that is under the hood not so exposed to the 
> programmer.

I don't see the advantage of this.


More information about the Digitalmars-d mailing list