I dun a DIP, possibly the best DIP ever

Stefan Koch uplink.coder at googlemail.com
Thu Apr 23 15:11:16 UTC 2020


On Thursday, 23 April 2020 at 15:06:51 UTC, Mafi wrote:
> On Thursday, 23 April 2020 at 12:43:59 UTC, Simen Kjærås wrote:
>>[...]
>
> I think ...-Expressions should first expand nested 
> ...-Expressions (or equivalently explicitly ignore nested 
> ...-Expressions). Then the cross-product can be expressed as:
>
> template crossHelper(F, X, Y...) {
>   alias crossHelper = F(X, Y)...;
> }
>
> crossHelper!(S, X, Y...)...
>
> => S!(X[0], Y[0]), S!(X[1], Y[0]), ..., S!(X[n-1], X[m-1])
>
> because the nested expression Y... is expanded first resulting 
> in crossHelper!(S, X, Y[0]), ..., crossHelper!(S, X, Y[m-1]) 
> which then has the X expanded.

that won't work.
F is a type parameter in crossHelper.


More information about the Digitalmars-d mailing list