Idea: swap with multiple arguments

Martin Tschierschke via Digitalmars-d digitalmars-d at puremagic.com
Wed May 25 10:08:02 PDT 2016


On Monday, 23 May 2016 at 20:01:08 UTC, Andrei Alexandrescu wrote:
> So swap(a, b) swaps the contents of a and b. This could be 
> easily generalized to multiple arguments such that swap(a1, a2, 
> ..., an) arranges things such that a1 gets an, a2 gets a1, a3 
> gets a2, etc. I do know applications for three arguments. 
> Thoughts? -- Andrei

A newbee question about language design:
When I looked first time at Ruby I liked the simple a,b = b,a 
syntax,
so swap. Would it be theoretically possible to allow this?

And if not, where does it breaks the general language design?

Best regards mt.


More information about the Digitalmars-d mailing list