[Dlang-internal] DIP1000 discussion and testing

Walter Bright via Dlang-internal dlang-internal at puremagic.com
Mon Oct 31 19:34:12 PDT 2016


On 10/31/2016 3:13 AM, Dicebot wrote:
>> 4. 'return ref scope' is treated as 'ref' and 'return scope' if the
>> function does not return by ref.
>>
>> Therefore,
>>
>>     TreeRange range(scope ref Tree this);
>>
>> is case 4, and the return value of 'range' will have the scope of the
>> value of the argument corresponding to 'this', which corresponds to the
>> scope of the argument.
>
> This makes no sense because declaration is not `TreeRange range(return
> ref scope Tree this)`, it is `TreeRange range(ref scope Tree this)`
> (absence of `return` is critical!)
>
> Does that mean that you have actually meant you first example to look
> like this:
>
> struct Tree
> {
>     TreeRange range () return ref scope
> }
>
> ?
>

Yeah, sorry, the 'return' is necessary as you said.


More information about the Dlang-internal mailing list