Static inheritance (proof of concept)

Iakh via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 29 13:43:41 PST 2016


On Monday, 29 February 2016 at 13:31:11 UTC, Atila Neves wrote:
>>
>> I'm not familiar with github so i can't see why it was rejected
>> besides auto testing tools (Looks like it's just outdated)
>
> http://forum.dlang.org/post/tgnxocozkurfvmxqofnn@forum.dlang.org
>
> Atila

I didn't get the point.
But I could propose one more way to implement it:) Just with 
template
mixins. If concept takes just one template
argument (as isInputRange do) then it could be passed just by 
name,
but if there are several args you have to fully instantiate it:

struct Range
{
     mixin checkConcept!isInputRange;
     mixin checkConcept!(isOutputRange!(Range, int));

     int front()
     {
         return 0;
     }
}

This way template mixin could take source line and file to 
generate better
report. First template arg of isOutputRange could be checked is 
it the
same as wrapping type to prevent copy-paste mistakes.


More information about the Digitalmars-d mailing list