On Friday, 15 May 2015 at 10:23:24 UTC, Per Nordlöw wrote:
I recall having seen an example of using some D magic (via mixin perhaps?) to realize tuple destructuring in assignments like

    magic(first, _, second) = expression.findSplit(separator);

I found it:

http://forum.dlang.org/thread/ubrngkdmyduepmfkh...@forum.dlang.org?page=1

I'm however still as frustrated because instead of having to specify tuple indexes explicitly as

     const result = expression.findSplit(separator);
     const first = result[0];
     const second = result[2];

I instead have to write types explicitly (no type-inference)

     string first, _, second; // non-generic unstable type guess
     tie(first, _, second) = expression.findSplit(separator);

or just as bad

     typeof(expression.findSplit(separator)[0]) first, _, second;
     tie(first, _, second) = expression.findSplit(separator);

Can this be solved with a mixin somehow?

Reply via email to