Are D classes proper reference types?

Stefan Koch uplink.coder at googlemail.com
Thu Jun 24 12:31:08 UTC 2021


On Thursday, 24 June 2021 at 07:28:56 UTC, kinke wrote:
> On Thursday, 24 June 2021 at 06:50:44 UTC, Ola Fosheim Grøstad 
> wrote:
>> [...]
>
> (I don't think I've ever seen one); with `scope c = new 
> Object`, you can have the compiler allocate a class *instance* 
> on the stack for you, but `c` is still a *ref*.

The dmd frontend uses them all the time to avoid allocation 
overhead for Visitors.



More information about the Digitalmars-d-learn mailing list