DIP1000: Scoped Pointers

ZombineDev via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Aug 15 00:10:00 PDT 2016


On Monday, 15 August 2016 at 04:56:07 UTC, Joseph Rushton 
Wakeling wrote:
> On Sunday, 14 August 2016 at 10:11:25 UTC, Guillaume Chatelet 
> wrote:
>> Isn't it what a scoped class is supposed to provide?
>>
>> class Rnd {}
>>
>> void foo() {
>>   scope rnd  = new Rnd; // reference semantic and stack 
>> allocated
>> }
>
> Does that actually work in D2? I thought it was a D1-only thing.

Yes, but for some unknown to me reason it was deprecated (or it 
will be in the future) in favour of std.typecons.scoped. 
Actually, it is used in many places throughout DDMD, so I don't 
think its going away soon.


More information about the Digitalmars-d-announce mailing list