Random Suggestion: Swap Operator <=>?

Walter Bright newshound1 at digitalmars.com
Fri Jul 17 18:56:54 PDT 2009


Julian Salazar wrote:
> Well, when was the last time you used "!<="?

As I remarked to Derek, there is no such thing as absolutes in engineering.

> But I'm wondering, what's your opinion of the generalized tuple 
> assignment syntax talked about above? Or more generally, supporting 
> tuples in the language?
> // Swap
> a, b = b, a;
> // Fibonacci!
> a, b = b, a+b;
> // Switching positions with the previous item in a doubly linked list, 
> just cause ;)
> item.prev.prev, item.prev.next, item.next, item.prev, 
> item.prev.prev.next, item.next.prev = item.prev.next, item.next, 
> item.prev, item.prev.prev, item, item.prev;
> 
> Okay, maybe I'll stop now...

It looks nice, but doesn't seem to offer a big improvement.



More information about the Digitalmars-d mailing list