<div dir="ltr">On 21 April 2013 11:36, Zach the Mystic <span dir="ltr"><<a href="mailto:reachzach@gggggmail.com" target="_blank">reachzach@gggggmail.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="im">On Sunday, 21 April 2013 at 00:51:31 UTC, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That's not what scope does. Scope promises that the variables will not<br>
escape the scope. And as such, just happens to make passing a temporary by<br>
ref safe.<br>
It does not implement r-value ref's. It simply allows refs to temporaries<br>
to be considered a safe operation.<br>
</blockquote>
<br></div>
It's a two-fer! (2 for 1 deal)<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This DIP is actually likely to solve an important source of problems,<br>
consider:<br>
<br>
void func(const ref matrix m);<br>
<br>
<br>
func(x.getMatrix()); // compile error!<br>
<br>
// fu*^&%$ing hell! you piece of &%^#≈¿$!<br>
// ...<br>
<br>
matrix temp = x.getMatrix();<br>
func(temp); // no more compile error! (but equally unsafe/dangerous)<br>
</blockquote>
<br></div>
It's hard to fully understand this example without getMatrix() defined, and why func() is unsafe (does it escape the reference?). Help!</blockquote><div><br></div><div style>definition:</div><div style>  matrix getMatrix(T x); // this is all you know</div>
<div style><br></div><div style>That's the point of the example. You _don't know_ if func() is unsafe, does it escape the reference? But you need to pass a temp anyway, you have no bearing on whether you should just hack it to work, or reconsider the problem.</div>
<div style>And when 99 times out of 100, the correct answer is 'hack it to work', you're basically asking for a spectacular bug in that other 1% of cases.</div><div style><br></div><div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<Side rant><br>
In my experience showing D to new people, this is the #1 complaint. It's<br>
the first one that comes up, every time (which really doesn't help with<br>
first impressions), and I'm fairly sure every single person I've introduced<br>
to D has complained about this.<br>
It's kind of embarrassing when I'm saying that D is really cool, and then I<br>
have to start making excuses and apologising for this, and assure them that<br>
it's a known issue, and it'll be fixed one day.<br>
</blockquote>
<br></div>
Yikes.<br>
</blockquote></div><br></div></div>