DIP 84: Static Inheritance

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 31 01:37:12 PDT 2015


On Friday, 30 October 2015 at 14:39:47 UTC, Atila Neves wrote:
> 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

I found a counter proposal which requires no code changes.

As you all know, certain constructs in D, only determine if 
something is possible or not, but give no error messages, this is 
implemented with a "gagging" mechanism.

I didn't look at the code for many months, but it roughly goes 
like this:
1) Enable Gag
2) Check if the code is valid
3) Disable Gag
4) Repeat above for all candidates.
5) If there's no unique match, print an error.
6) Exit

The key idea is that once we reach 5, we know that we will fail, 
now instead of Exiting the compiler we could re-run the failing 
chain, only this time without any GAG:s.

a) No user-code impact, all old software will immediately benefit.
b) We will get the full error messages.
c) Compilation time of working programs stays the same, because 
this only kicks in once we are going to abort anyway.



More information about the Digitalmars-d mailing list