DIP35: supplement to DIP25: Sealed References

Zach the Mystic reachzach at gggggmail.com
Sat Apr 6 22:36:23 PDT 2013


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.)


More information about the Digitalmars-d mailing list