DIP 84: Static Inheritance

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 31 02:21:30 PDT 2015


On Saturday, 31 October 2015 at 08:38:01 UTC, Walter Bright wrote:
> On 10/30/2015 7:39 AM, Atila Neves wrote:
>> Please let me know what you think.
>
> Thanks for writing this. I think it's a very creative solution.
>
> I've used the static assert technique you mentioned in the DIP. 
> It solves the first part of the problem, that of shifting the 
> detection of the error from the usage of the struct to the 
> definition of the struct.
>
> The remaining problem is the suppression of the error message 
> detailing why it failed the test. Perhaps a more general 
> solution is a __traits(compiles, expr) feature that does not 
> suppress error messages.

Interesting. Like this perhaps?

struct Struct : isInputRange ->

static assert(__traits(compilesNoSupress, isInputRange!Struct));
struct Struct
//...

Atila


More information about the Digitalmars-d mailing list