DIP35: supplement to DIP25: Sealed References

deadalnix deadalnix at gmail.com
Sun Apr 7 06:32:35 PDT 2013


On Sunday, 7 April 2013 at 05:36:26 UTC, Zach the Mystic wrote:
> http://wiki.dlang.org/DIP35
>
> I've talked about this before, but it seems like the right time 
> to formalize it, especially to illustrate the slight conflict 
> it would impose on using 'scope ref' to allow rvalue temporary 
> references. If 'ref' itself were made completely safe using 
> 'scope' and/or 'out' return values, it would be possible to 
> allow even rvalue temporaries to escape by returning from the 
> function they were passed to. It may not in fact be a good 
> programming practice, but that is a different design decision. 
> If returning rvalue references were disallowed, it would 
> therefore pose no threat to using 'scope ref', since 'scope' 
> and 'scope ref' would be fully compatible then. (I'm not 
> specifically in favor of 'scope ref' to mean rvalue 
> temporaries, but at least this compatibility issue is laid on 
> the table. I don't think it's a horrible choice either, because 
> it saves on syntax creep, but its meaning *is* confusing at 
> first glance.)

At this point, I'm not sure why we simply don't consider to 
introduce the concept of lifetime, rust style.


More information about the Digitalmars-d mailing list