On Monday, 7 October 2013 at 21:56:21 UTC, Artur Skawina wrote:
Neat. But dangerous. You'll want type safety (ie using the same 'T' everywhere) and 'ref' instead of 'auto ref' (the latter will accept rvalues, so you could be taking an address of a local variable and
escaping it).

Let me try, with a slightly safer version:

void list(A...)(typeof([A]) a) @property { foreach (I, ref _; A) A[I] = a[I]; }

   void main(string[] args) {
       int a, b, c;

       list!(a, b, c) = [1, 2, 3];

       import std.stdio;
       writeln(a);
       writeln(b);
       writeln(c);
   }

SCNR. We need an IODCC. :^)

artur

We are so close to a destructuring syntax it hurts. Is there any way to insert a, b and c into the current scope automagically?

Reply via email to