I dun a DIP, possibly the best DIP ever
Steven Schveighoffer
schveiguy at gmail.com
Fri Apr 24 12:22:51 UTC 2020
On 4/24/20 1:16 AM, Simen Kjærås wrote:
> On Friday, 24 April 2020 at 00:16:52 UTC, Manu wrote:
>> On a slightly unrelated note; there's a really interesting idea up-thread
>> about making nested `...` not be expanded by the outer `...`
>> For instance:
>>
>> template T(A, B...) { ... }
>> T!(Tup1, Tup2...)...
>
> I'm wondering if perhaps that's the wrong way around - AliasSeq already
> does that:
>
> T!(Tup1, AliasSeq!Tup2)... // Should only expand Tup1
No, this means:
T!(Tup1[0], AliasSeq!(Tup2[0])), T!(Tup1[1], AliasSeq!(Tup2[1]), ...
> It might be that the more useful behavior is for ...-tuples to be
> expandable:
>
> T!(AliasSeq!(int, char)..., AliasSeq!Tup2)... // Should expand to
> T!(int, Tup2), T!(char, Tup2)
>
I think the suggestion quoted by Manu is more useful, we should ignore
any inner ... when expanding an outer one. This gives maximum
flexibility. If you want something that's not considered a tuple to be
considered a tuple, you have the option of declaring it into a tuple
before the expression. If you want to go the other way (prevent
expansion of a tuple with ...), without this idea there's no recourse
(well, you could do a mixin, but that would suck).
-Steve
More information about the Digitalmars-d
mailing list