<div class="gmail_quote">On Thu, May 9, 2013 at 10:14 PM, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@erdani.org</a>></span> wrote:<br><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 5/9/13 10:05 PM, Steven Schveighoffer wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, 09 May 2013 21:47:14 -0400, Andrei Alexandrescu<br>
<<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@erdani.org</a><u></u>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 5/9/13 4:36 PM, Peter Alexander wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm not sure about how common it is, but I really don't like the idea of<br>
calls like swap(1, 2) being legal. Seems like a step backward from C++.<br>
</blockquote>
<br>
I think if we ever get swap(1, 2) to compile and run we'd effectively<br>
have destroyed the D programming language.<br>
</blockquote>
<br>
Depends on context.<br>
<br>
int swap(int diskNum, int partitionNum);<br>
<br>
Someone pointed out that swap could be a function that swaps heap<br>
indexes, and might even take by ref not caring if you want the resulting<br>
value that was swapped.<br>
<br>
with(someHeap)<br>
{<br>
swap(1, 2); // swap indexes 1 and 2<br>
}<br>
<br>
-Steve<br>
</blockquote>
<br></div></div>
Now that's great trolling!<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br>To clear my name, just in case: I wasn't trolling. I have a use case (in a heap implementation):<br><br>

    void indexSwap(ref int a, ref int b) {<br>       swap(array[a], array[b]);<br>       swap(a, b);<br>    }<br><br>It would be great to be able to call indexSwap(index, index*2 + 1) in one line without having to create a named temporary for the second argument, and with having it mutate index to be index*2 + 1. I think auto ref solves it, though a call-site solution (an inline way to create that temporary) seems like it would work too.<br>

<br>Dmitry<br></div></div>