DIP 84: Static Inheritance

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 30 09:44:13 PDT 2015


On Friday, 30 October 2015 at 15:45:00 UTC, Shammah Chancellor 
wrote:
> On Friday, 30 October 2015 at 14:39:47 UTC, Atila Neves wrote:
>> From the discussion here: 
>> http://forum.dlang.org/post/tgnxocozkurfvmxqofnn@forum.dlang.org, I thought a library solution would do to fix the issue of getting decent error messages when a type fails to satisfy a template constraint that it was meant to, such as `isInputRange`. So I submitted a PR (https://github.com/D-Programming-Language/phobos/pull/3677), it's been there ever since and doesn't seem like it'll go anywhere from the discussion (http://forum.dlang.org/post/qvofihzmappftdiwdaue@forum.dlang.org).
>>
>> So the only other way is a DIP (http://wiki.dlang.org/DIP84) 
>> for language and compiler support for static inheritance. It's 
>> backwards-compatible and IMHO worth looking at.
>>
>> Please let me know what you think.
>>
>> Atila
>
> Atila,  did you get a chance to look at the 
> std.experimental.concepts work I was doing?
>
> It's very similar to what you seem to want, but the diagnostic 
> messages are really annoying to use as you have to make a 
> default template that the user can fall through to:
>
> https://github.com/schancel/phobos/blob/4ca5d075f31b8e09ba71ac2a53ff56ff0c4ac5b9/std/experimental/concepts.d
>
> -Shammah

I took a look. I don't think we should or need to use classes and 
therefore dynamic polymorphism to solve the problem of checking 
for adherence to a static interface.

Mostly all I want is for the compiler to tell me why something 
doesn't compile - it already knows it but is hiding the 
information from me.

Atila


More information about the Digitalmars-d mailing list