DIP 36: Rvalue References

deadalnix deadalnix at gmail.com
Sun Apr 21 09:33:24 PDT 2013


On Sunday, 21 April 2013 at 16:02:35 UTC, Zach the Mystic wrote:
> On Sunday, 21 April 2013 at 02:50:02 UTC, deadalnix wrote:
>> If that is your concern then the DIP36 is a very bad answer to 
>> it :
>> - It require extra anotation, which wont be added most of the 
>> time.
>
> It's possible to make it an error to pass a stack variable to a 
> non-'scope' ref parameter. Or to make it an error in @safe code 
> only. But those may be extreme measures.

No they aren't.

> This also raises the issue that some types of escape are more 
> dangerous than others.

This is why the notion of lifetime is needed.

> 'scope' is also the kind of thing which might be better as the 
> default than as something you must specifically add. But then 
> we'd need an attribute '@noscope' or something like that. Ugh.
>

Inference is always a solution.

>> - It is inferior, and impair the introduction of lifetime. 
>> This isn't even discussed.
>
> You've mentioned lifetime a couple times. Can you show what 
> lifetime is and show how it contrasts with the current 
> proposal, particularly DIP25?

Here is a good link to start :
http://smallcultfollowing.com/babysteps/blog/2012/07/17/borrowed-pointer-tutorial/


More information about the Digitalmars-d mailing list