Static inheritance (proof of concept)

Iakh via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 27 11:45:58 PST 2016


On Saturday, 27 February 2016 at 18:14:25 UTC, Chris Wright wrote:
> On Sat, 27 Feb 2016 13:35:30 +0000, Iakh wrote:
>
> Looks good. I'd prefer to have just the mixin or just the 
> attribute -- the latter being tricky just now.
Agree.

> It'd be just as easy to make it:
>
> struct Range {
>   mixin ensureConcept!isInputRange;
> }

It is hard to pass all params to the mixin such as file, line and 
additional params for concept:

@concept!(isOutputRange, int)() // isSomething!(T, a, b, c, d, 
...)
struct Range
{
     mixin checkConcepts; // mixin takes current line and file 
with default params to do error checking so there is no way to 
use variadic args (is it?)
}



More information about the Digitalmars-d mailing list