DIP69 - Implement scope for escape proof references

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 10 19:27:04 PST 2014


On 12/9/2014 10:43 PM, deadalnix wrote:
> On Wednesday, 10 December 2014 at 05:23:29 UTC, Walter Bright wrote:
>> On 12/8/2014 3:21 PM, deadalnix wrote:
>>> On Monday, 8 December 2014 at 21:16:36 UTC, Walter Bright wrote:
>>>> A 'scope ref' parameter may not be returned as a 'ref' or a 'scope ref'.
>>>>
>>>
>>> It can safely be returned if you consider its lifetime as the
>>> intersection of the lifetime of the function's parameter.
>>
>> The only purpose to a 'scope ref' parameter is to say it isn't being returned.
>> 'ref' itself does not escape in any way other than by returning.
>
> That is a completely useless feature. Also, you want to have scope return for
> container like thing.

I disagree. It's critical for chaining one function to the next.


More information about the Digitalmars-d mailing list