I dun a DIP, possibly the best DIP ever
pineapple
meapineapple at gmail.com
Thu Apr 23 15:32:06 UTC 2020
I like this idea, but I don't like the syntax.
pragma(msg, (Values + OnlyTwo)...);
alias staticMap(alias F, T...) = F!T...;
The immediate impression I have reading this code is that the
`...` postfix operator is modifying the result of `Values +
OnlyTwo` or `F!T`, but this isn't the case.
This syntax decision would make D less accessible to new people
and would make code take just that little bit more effort to read
even for people who know the syntax.
I would suggest that something should be written postfixing or
prefixing the alias sequence itself, so that it is more clear
that the operation is changing the nature of that sequence and
how it is operated upon, rather than acting upon the result of an
operation involving that sequence.
One example to illustrate what I mean by moving the operator:
pragma(msg, (Values[...] + OnlyTwo[...]));
alias staticMap(alias F, T...) = F[...]!T;
I think something other than `[...]` or `...` would also be fine,
it's the position specifically that I want to make a point about.
More information about the Digitalmars-d
mailing list