DIP 36: Rvalue References

Dicebot m.strashun at gmail.com
Tue Apr 23 01:32:55 PDT 2013


On Tuesday, 23 April 2013 at 08:25:18 UTC, Timon Gehr wrote:
> (Both of these are in error because static variables are 
> initialized at compile time, but I get what you mean.)

Shame on me! (blush)

> Why would 'scope' have any effect on the validity of the first? 
> s.a belongs to the callee exclusively. Adding modular 
> annotations to prevent taking its address has no point.

Because it is an attempt to take/store address of a scope 
variable, which is prohibited by scope definition. I think (but I 
am not sure!) that it makes sense to make scope transitive for 
aggregation, because automatic destruction upon leaving the scope 
happens for aggregated entities. Thus, nothing can be known about 
s.a lifetime, same as s lifetime. This is one step towards 
consistent "scope" behavior that will allow safety desired by 
this DIP.


More information about the Digitalmars-d mailing list