[Dlang-internal] DIP1000 discussion and testing

Dicebot via Dlang-internal dlang-internal at puremagic.com
Mon Oct 31 03:13:47 PDT 2016


On 10/31/2016 11:53 AM, Walter Bright wrote:
> I'm a bit baffled why I am unable to explain this.

Walter it is very uncomfortable to see that are trying to explain me my
own words (".. no lifetime restriction ever happens in absence of
explicit `return scope` annotation.. ") as if I don't understand that.
It sometimes feels like you spot some random keywords and completely
ignore actual content of the question.

You are unable to explain simply because you don't explain what was
asked. I know the difference between `scope` and `return scope`, and I
ask questions exactly because I know it and last proposal doesn't make
sense with it.

See below:

> 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
}

?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/dlang-internal/attachments/20161031/48e1be58/attachment.sig>


More information about the Dlang-internal mailing list