DIP1000: Scoped Pointers

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


On Monday, 15 August 2016 at 07:19:00 UTC, lobo wrote:
> On Monday, 15 August 2016 at 07:10:00 UTC, ZombineDev wrote:
>> 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.
>
> When was it deprecated? I use it a lot and DMD 2.071.1 gives no 
> warning.
>
> bye,
> lobo

It's not deprecated, but it will be, at least according to this 
page: http://dlang.org/deprecate. (Search for "scope for 
allocating classes on the stack".)


More information about the Digitalmars-d-announce mailing list