Pattern matching is-expressions
uplink.coder at googlemail.com
Fri Aug 21 00:16:41 UTC 2020
On Wednesday, 19 August 2020 at 13:07:40 UTC, Stefan Koch wrote:
> And I think I have found a way to support them within the
> is(T S == super) would become
> auto f(alias T)
> static literal bool r = is(T S == super);
> // here alias S = (r ? SuperTupleOf(T) : ErrorType) is
> automatically declared.
> // where ErrorType is the value for which `!is(ErrorType)`
> is true
Back to the drawing board, it turns out my initial fears were
Making an identifier into a variable declaration depending on
whether you are in a type function or not; Is a funky thing to do.
I'll to go with additional __traits.
Besides I do think that __traits(getSuperType, T)
does look more readable than is(T S == super)
even though it does not give you the "symbolic equation" feeling
More information about the Digitalmars-d