I dun a DIP, possibly the best DIP ever

Steven Schveighoffer schveiguy at gmail.com
Fri Apr 24 12:54:16 UTC 2020


On 4/24/20 4:24 AM, Walter Bright wrote:
> On 4/23/2020 11:00 PM, Manu wrote:
>> I guess this is the key case you need to solve for:
>>
>>    template T(Args...) {}
>>    T!(Tup)     -> T!(0, 1, 2)
>>    T!(Tup)...  -> T!0, T!1, T!2
>>
>> And the parallel expansion disambiguation is also critical:
>>    T!(Tup, Tup2...)...  -> T!(0, 3, 4, 5), T!(1, 3, 4, 5), T!(2, 3, 4, 5)
>>
>> If you can solve those, the rest will probably follow.
> 
> Fair enough. Though there needs to be a rationale as to why those two 
> particuler cases are needed and critical.

I think there's a fundamental piece missing from the requirements, you 
need to be able to specify where the expansion should stop. Otherwise, 
the expressions become very difficult to use effectively.

e.g.:

T!(U!(V!(Tup))...) -> T!(U!(V!0), U!(V!1), U!(V!2))

-Steve


More information about the Digitalmars-d mailing list