DIP69 - Implement scope for escape proof references
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Thu Dec 11 23:56:53 PST 2014
On Friday, 12 December 2014 at 06:57:54 UTC, deadalnix wrote:
> On Friday, 12 December 2014 at 06:06:40 UTC, Dicebot wrote:
>> On Thursday, 11 December 2014 at 21:41:11 UTC, Walter Bright
>> wrote:
>>> Consider a ref counted type, RC!T. If scope were transitive,
>>> then you could not have, say, a tree where the edges were
>>> RC!T. I.e., the payload of an RC type should not be forced to
>>> be scope.
>>
>> I don't see how this is related. It would be perfectly ok to
>> declare root of such tree scope if it was transitive (as long
>> as it only controls access and does not attempt early
>> destruction).
>>
>
> That is my proposal. However, it is not as simply as you think
> it is without making it a type qualifier (which is not
> desirable).
>
> In effect, that mean that you can see something that has
> infinite lifetime through a scope reference, so you need to
> track lifetime rvalue and lvalue differently.
>
> I'm still for it. The current proposal is not powerful enough
> to pull its weight.
I don't hope it will be simple. It is all about making scope as
simple as possible to keep it useful for idiomatic D code - but
not simpler.
More information about the Digitalmars-d
mailing list