DIP32: Uniform tuple syntax
bearophile
bearophileHUGS at lycos.com
Fri Mar 29 08:49:18 PDT 2013
kenji hara:
>> 5 .expand (or similar) property is missing.
>>
>
> Use tup[]. It is already exists.
You are right, I didn't know/remember about that:
import std.typecons;
void foo(int, int) {}
void main() {
auto t = tuple(1, 2);
foo(t.tupleof);
foo(t[]);
auto t2 = tuple(1, 2, 3);
foo(t2[0 .. 2]);
}
But I don't like that. t2[0 .. 2] should return a new tuple that
contains just the first two items. And like every one tuple it's
not supposed to auto-unpack. So I think this is a design mistake
that should be fixed in the new tuples.
Bye,
bearophile
More information about the Digitalmars-d
mailing list