<div dir="ltr">On 24 April 2013 00:24, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@erdani.org</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"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>The very point of this DIP is to not create<br>
syntax-driven features, instead better define existing ones that make<br>
sense on their own so they can be used for same purpose.<br>
</blockquote>
<br></div>
It's a new feature, no two ways about it. It overlaps ref and auto ref without any palpable benefit and defines yet another way to achieve the same thing as auto ref. On this ground alone the proposal has a large problem.</blockquote>
<div><br></div><div style>How does it overlap ref? It simply justifies the argument with an extra constraint and isn't tied to 'ref' at all, it's just useful in conjunction.</div><div style><br></div><div style>
I can't agree that it overlaps auto-ref at all. They're fundamentally different concepts. auto-ref is a template concept; it selects the ref-ness based on the received arg. 'auto ref', ie, 'automatic ref-ness'. It makes no sense on a non-template situation.</div>
<div style>I'm still completely amazed that the very reason this DIP makes perfect sense to me(/us) is the same reason you have a problem with it.</div><div><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"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2. The proposal is sketchy and does not give many details, such as the<br>
lifetime of temporaries bound to scope ref objects.<br>
</blockquote>
<br>
It can't because lifetime of temporaries is not defined in D at all and<br>
suck stuff needs to be consistent. It is not really different from a<br>
lifetime of struct literal temporary used for pass-by-value.<br>
</blockquote>
<br></div>
A proposal aimed at binding rvalues to references must address lifetime of temporaries as a central concern.</blockquote><div><br></div><div style>It's not an r-value, it's a standard stack-allocated temporary. It's lifetime is identical to any other local.</div>
<div style>The reason it's not detailed in the proposal is because it adds no such new feature, and makes no changes. The lifetime of a local is well understood.</div><div><br></div><div><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"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
3. The relationship with auto ref is insufficiently described, e.g.<br>
there should be clarification on why auto ref cannot be improved to<br>
fulfill the desired role.<br>
</blockquote>
<br>
auto ref is a template-world entity. If by "improved" you mean<br>
"completely reworked" than sure, I can add this rationale. Will do today.<br>
</blockquote>
<br></div>
I think we should focus on <a href="http://d.puremagic.com/issues/show_bug.cgi?id=9238" target="_blank">http://d.puremagic.com/issues/<u></u>show_bug.cgi?id=9238</a> and on making ref safe.</blockquote><div><br></div><div style>
I don't believe it's possible to make ref safe. Can you suggest any vision for this?</div><div style>It's unsafe by definition... you are passing a pointer of unknown origin to a function that could do anything with that pointer.</div>
<div style>Hence 'scope ref', which appropriately restricts what the callee is able to do with it.</div><div><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"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
4. Above all this is a new language feature and again we want to<br>
resort to adding new feature only if it is clear that the existing<br>
features are insufficient and cannot be made sufficient. In particular<br>
we are much more inclined to impart real, demonstrable safety to "ref"<br>
and to make "auto ref" work as a reference that can bind to rvalues as<br>
well as lvalues.<br>
</blockquote>
<br>
Can't agree. "scope" is defined (but not implemented, a pity). Creating<br>
temporaries already exists for some cases. No really new language<br>
feature is added. No special syntax created. "scope ref" is still<br>
"scope" and "ref" with all semantics this imposes, rvalue references are<br>
just a side-effect. Contrary to this, "auto ref" IS a new feature<br>
created specifically for syntax hack. That is a very problem you are<br>
speaking about - introducing new concepts instead of making use of ones<br>
that exist for ages.<br>
</blockquote>
<br></div>
You are of course to disagree, but that would make you wrong.</blockquote><div><br></div><div style>Explain why? Proclaiming he is simply wrong when he presents sound reason isn't helpful.</div></div></div></div>