On 3/15/12 11:30 AM, Manu wrote:
On 15 March 2012 17:32, Andrei Alexandrescu
<seewebsiteforem...@erdani.org <mailto:seewebsiteforem...@erdani.org>>
wrote:
One note - the code is really ingenious, but I still prefer swap()
in this case. It's more concise and does less work in the general case.
swap(a[i + k], a[j + j]);
only computes the indexing once (in source, too).
It all still feels to me like a generally ugly hack around the original
example:
a,b = b,a;
It's a function call. Why is a function call a ugly hack?
It's also more verbose. Compare
swap(a[i + k], a[i + j]);
with
a[i + k], a[i + j] = a[i + j], a[i + k];
I mean one could even easily miss a typo in there.
There's also semantic issues to be defined. What is the order of
evaluation in
f(), g() = h(), k();
?
All of this adds dead weight to the language. We shouldn't reach to new
syntax for every single little thing.
Andrei