<div class="gmail_quote">On 11 May 2012 11:24, kenji hara <span dir="ltr"><<a href="mailto:k.hara.pg@gmail.com" target="_blank">k.hara.pg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Just before the release of 2.059, I implemented the behavior to avoid<br>
breaking of existing codes for only struct literals. I didn't support<br>
other rvalues with it, like such ternary expression. It was minimum<br>
hack.<br>
<br>
I think it is a special behavior of 2.059, and I've been highly<br>
skeptical to leave it up to the future, even if changing it breaks<br>
existing codes.<br>
<br>
I also think that a need of 'auto ref stroage class for non-template<br>
function parameter' is increasing.<br></blockquote><div><br></div><div>Yeah, I've run into a need for 'auto ref' a few times now actually, and I've also been running into these lvalue->ref problems all week.</div>
<div>What are the odds that full const ref support might be fleshed out some time soon? We're having to implement quite a few work around for it...</div><div><br></div><div>This problem has gotten me thinking though, should ref just be a proper storage class? (why isn't it?)</div>
<div>It seems that would address almost all problems with it immediately.</div><div>  - There are also some syntactical issues/ambiguities that ref(type) would solve.</div><div>  - You'd be able to declare ref locals (which would be super useful)</div>
<div>  - 'auto' would work, no need to special case said 'ref auto', which seems a but nasty, in generic code you might not always want that... It'll only be a matter of days before someone wants a 'true' auto.</div>
<div>  - Solve these recently discussed issues where you can't describe a function/delegate that returns by ref without piping it through an alias.</div><div><br></div><div>All ref should really be, is syntactical sugar for a pointer, which asserts that it be non-null/initialised, and that it not expose the pointer assignment mechanism.</div>
<div>Is there something more that 'ref' does in D that wouldn't work under that setup?</div></div>