newbie question: Can D do this?

Simen Kjærås simen.kjaras at
Mon Dec 19 11:01:06 PST 2011

On Mon, 19 Dec 2011 17:17:43 +0100, clk <clk at> wrote:

> Hello,
> I'm new to this mailing list.  I'm trying to learn D  to eventually use
> it in production code.
> I'm a little bit intimidated by the fact that the topics in the d-learn
> list look rather advanced to a newbie like me.
> I have 3 fairly simple questions:
> 1) Does D support something like the javascript 1.8 destructuring
> assigment (multiple assigment in python):
> [a, b] = [b, a];

This, or something quite like it, was covered on Saturday in the thread
"Alias/Ref Tuples ?". This works (but is hardly as elegant as Python's

import std.typetuple : TypeTuple;
import std.typecons : tuple;

TypeTuple!(a, b) = tuple(b,a);

More information about the Digitalmars-d-learn mailing list