DIP 84: Static Inheritance
Colden Cullen via Digitalmars-d
digitalmars-d at puremagic.com
Tue Nov 10 16:51:39 PST 2015
On Tuesday, 10 November 2015 at 10:45:16 UTC, Atila Neves wrote:
> [snip]
>
> Updated.
>
> Atila
As long as we're talking about syntax features that help this
emulate regular inheritance, would it be worth adding a feature
like this:
template MySuperType(T)
{
enum MySuperType = validate!T;
}
void doAThing(MySuperType T)(T val) { }
That would effectively lower to:
void doAThing(T)(T val) if(__traits(compiles, MySuperType!T)) { }
with better error reporting? This would certainly make the code
more readable, and would simplify the conditional dramatically if
you had more than 1 or 2 template parameters.
More information about the Digitalmars-d
mailing list