<div dir="ltr">2013/3/30 Timon Gehr <span dir="ltr"><<a href="mailto:timon.gehr@gmx.ch" target="_blank">timon.gehr@gmx.ch</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On 03/29/2013 04:32 PM, kenji hara wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
2013/3/29 Timon Gehr <<a href="mailto:timon.gehr@gmx.ch" target="_blank">timon.gehr@gmx.ch</a> <mailto:<a href="mailto:timon.gehr@gmx.ch" target="_blank">timon.gehr@gmx.ch</a>>><div class="im">It will be parsed as:<br>
</div><div class="im">
{     // tuple braces<br>
</div></blockquote>
<br>
It contains ';', therefore the DIP says it is a function literal brace.<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
     {;}   // function literal braces<div class="im"><br>
}<br>
<br>
       {{if(foo()){}}} // a non-tuple matching your specification<br>
<br>
<br></div><div class="im">
{    // tuple braces<br>
     {    // function literal braces<br>
</div></blockquote>
<br>
There is no ';', therefore the DIP says it is a tuple brace.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
         if (foo()){}   // "if" always appears in statement scope<br>
     }<br>
}<br>
<br>
</blockquote>
<br></div>
I know how it _should_ be. The DIP contradicts what you say.<br></blockquote><div><br></div><div style>Sorry my incomplete description and poor English. I'll improve description in DIP.</div><div>  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
Allowing value swap in tuple assignment will make language complex. I<br>
can't agree with it.<br>
</div></blockquote>
<br>
Quite obviously it is the other way round. There will be a never-ending flood of d.D.learn posts on the topic.<br></blockquote><div><br></div><div style>Yes, I agree with it. But, I won't change my opinion. So I'll stop talking about that.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
       - Which right-hand sides are allowed with which semantics?<br>
<br>
<br></div><div class="im">
Whether it is a pattern or a tuple-literal, is distinguished by their<br>
appeared locations.<br>
</div></blockquote>
<br>
Obviously, but this statement is not related to my question.<br>
Valid right-hand sides seem to be at least tuples and expanded tuples (sequences). Anything else?<br></blockquote><div><br></div><div style>Sorry I don't understand you question.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
    4 There is no way to capture the part matched by "..."<br>
<br>
<br></div><div class="im">
I think this should be allowed.<br>
<br>
auto {x, r...} = tup;<br>
// Lowered to:<br>
// auto x = tup[0];<br>
// auto r = tup[1..$]<br>
<br>
`...` is very consistent token for this purpose.<br>
</div></blockquote>
<br>
Questionable.<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
template X(T...) {}<br>
alias x = X!(int, long);  // T captures {int, long}<br>
<br>
</blockquote>
<br></div>
Not really. T captures {int, long}.expand.<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
    5 .expand (or similar) property is missing.<br>
<br>
<br></div><div class="im">
Use tup[]. It is already exists.<br>
</div></blockquote>
<br>
Slicing obviously shouldn't auto-expand. It's a shortcoming of the Phobos tuple introduced because static slicing cannot be overloaded.<br></blockquote><div><br></div><div style>I think it will become reasonable. If you really want re-packing tuple, you can use {tup[0..1]}. It's quite handy.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
    6 Relation to {a: 2, b: 3}-style struct literals not explained.<br>
<br>
<br></div><div class="im">
I am skeptical of the necessity of tuple literal with named fields.<br>
<br>
</div></blockquote>
<br>
Sure, but you'd at least have to argue in the DIP that the parser can distinguish the two, and how.<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
    7 Tuple unpacking for template parameters not mentioned.<br></div></blockquote></blockquote><div><br></div><div style>Will add description about it. </div><div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
    Is there a migration path for Phobos tuples planned?<br>
<br>
    Eg. template Tuple(T...){ alias Tuple = {T}; }<br>
         (field spec parsing left out for illustration)<br></div></blockquote></blockquote><div><br></div><div style>I have no plan.</div><div style><br></div><div style>Kenji Hara </div></div></div></div>