Are D classes proper reference types?
kinke
noone at nowhere.com
Thu Jun 24 17:38:23 UTC 2021
On Thursday, 24 June 2021 at 12:31:08 UTC, Stefan Koch wrote:
> 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.
I was talking about not having seen a `scope class C { ... }`,
*not* the `scope` storage class as in the example.
More information about the Digitalmars-d-learn
mailing list