DIP69 - Implement scope for escape proof references

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 11 00:29:19 PST 2014


On 12/10/2014 11:55 PM, deadalnix wrote:
> On Thursday, 11 December 2014 at 07:30:03 UTC, Walter Bright wrote:
>> On 12/10/2014 8:56 PM, deadalnix wrote:
>>> On Thursday, 11 December 2014 at 03:27:08 UTC, Walter Bright wrote:
>>>> I disagree. It's critical for chaining one function to the next.
>>>
>>> I one can't return, one can't chain.
>>
>> I guess I'm not seeing the problem.
>
> a.foo().bar() is the same as bar(foo(a)), that is, using the returned value as
> first parameter. If you can't return, you can't chain.

Right, and you can chain when the declarations are:

scope ref S foo(ref T a);
U bar(ref S s);

a.foo().bar(); // works


More information about the Digitalmars-d mailing list