<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">2013/3/29 Dmitry Olshansky <span dir="ltr"><<a href="mailto:dmitry.olsh@gmail.com" target="_blank">dmitry.olsh@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
A few typos like:<br>
{c, $} = tup;   // Rewritten as: a = tup[0];<br>
where it should be //Rewritten as c = tup[0];<br></blockquote><div><br></div><div>Thanks. Fixed. </div><div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

About swapping values by tuple assignment.<br>
<br>
Why not simply make this work:<br>
{x, y} = {y, x}<br>
<br>
By lowering<br>
{x, y}  = {y, x};<br>
to<br>
auto temp0 = y;<br>
auto temp1 = x;<br>
x = temp0;<br>
y = temp1;<br>
<br>
And let the compiler do value propagation to remove the extra temp0.<br></blockquote><div><br></div><div>Because it already exists.<br></div><div><div><br></div><div>template Seq(T...) { alias Seq = T; }</div><div>void main()</div>
<div>{</div><div>    int x = 1, y = 2;</div><div>    Seq!(x, y) = Seq!(y, x);    // tuple assigmnent</div><div>    assert(x == 2);</div><div>    assert(y == 2);</div><div>}</div></div><div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Another note - is there any way to extend this notation to common structs other then .tupleof ? I think we may hopefully extended it later towards struct destructruing a-la EcmaScript 6, see<br>
<br>
<a href="http://wiki.ecmascript.org/doku.php?id=harmony:destructuring" target="_blank">http://wiki.ecmascript.org/<u></u>doku.php?id=harmony:<u></u>destructuring</a></blockquote><div><br></div><div>Hmm, interesting. I'll see it later.</div>
<div> </div><div>Kenji Hara</div></div><br></div></div>