<div dir="ltr">On 26 April 2013 08:36, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com" target="_blank">jmdavisProg@gmx.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wednesday, April 24, 2013 08:54:09 Zach the Mystic wrote:<br>
> On Wednesday, 24 April 2013 at 02:56:42 UTC, Jonathan M Davis<br>
><br>
> wrote:<br>
> > So, probably the best route at this point is to come up with a<br>
> > new attribute<br>
> > which is replace with ref in the function definition and<br>
><br>
> When you say "replace with ref", does that mean 'ref' won't<br>
> appear in the common case?<br>
><br>
> ref T fc(scope int a) {}<br>
><br>
> The problem would be that 'scope' would behave differently,<br>
> implying 'ref' with a value type, from with a reference type, in<br>
> which it shouldn't imply 'ref'. I don't know if it makes sense to<br>
> automatically promote the meaning of 'scope' to include 'ref' for<br>
> value types while leaving it alone for reference types. This was<br>
> objected to by others, but if it were provably harmless to allow,<br>
> it would be an appearance improvement.<br>
<br>
</div></div>You misunderstand me (possibly because I didn't proofread what I wrote). What<br>
I mean is that the way that auto ref should work with non-templated functions<br>
is that<br>
<br>
auto foo(auto ref T param) {...}<br>
<br>
becomes<br>
<br>
auto foo(ref T param) {...}<br>
<br>
underneath the hood. Then when you pass an rvalue to it - e.g. foo(T(5)) -<br>
that gets translated to something like<br>
<br>
T __temp = T(5);<br>
foo(__temp);<br>
<br>
Then auto ref works with both lvalues and rvalues with only one function<br>
definition, and ref is unchanged in how it works (it still only accepts<br>
lvalues).<br></blockquote><div><br></div><div style>Why bother with 'auto'? Why not just make this default behaviour?</div></div></div></div>