<html><body><div><br></div><div><br>On Apr 11, 2012, at 02:57 AM, Walter Bright <walter@digitalmars.com> wrote:<br><br><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch"> Our D solution, disallowing rvalue references, is technically sound but as we've <br> discussed here is a usability disaster, and auto ref isn't going to cut it. We <br> figured a solution is:<br> <br> *** Allow rvalue references, however, disallow any implicit conversions of the <br> literal's type in the process of taking a reference to it. ***<br> <br> That takes care of 1 and 2. The solution to 3 is a bit more subtle. Some people <br> have wondered why the D compiler can create reference types itself, but does not <br> allow the user to outside of function parameters and foreach variables. This is <br> the reason why. References, in order to be safe, must not be allowed to escape a <br> scope. They can only be passed downward to enclosed scopes, and returned from <br> functions where the return value is checked. Also, one cannot take the address <br> of a reference. I think this closes the holes.<br> <br> With all that, I intend to once again allow struct literals to be lvalues for <br> 2.059. Somewhat later, also allow references to other literals like 0 and 5.6. <br></div></div></blockquote><span><br>I think this should be posted on the newsgroup as well.<br><br></span>--<br>/Jacob Carlborg<br></div></div></body></html>