More Clang diagnostic

bearophile bearophileHUGS at lycos.com
Tue Oct 26 04:09:27 PDT 2010


Walter:

> Only because clang made a marketing issue out of it. Nobody coming from dmc++
> noticed.
> 
> I used to point out this feature in dmc++ to users. Nobody cared, I'd just get
> blank looks. Why would I drop it if people wanted it?

Maybe it's all just marketing. But sometimes marketing is also a form of education, it teaches people a new way to do something, or why they should care about something.

Another possibity is that maybe the ecosystem around a language is changed, today more people use an IDE (especially people that don't use C/C++), and if you are using an IDE then maybe it is an useful feature.

Probably reality is a mix of those different possibilities.


> Clang did have a nice idea with the spelling corrector. I implemented it in dmc
> and dmd, and got flak for "wasting time" by adding it. I still like it, though,
> and think it's an improvement :-)

In my opinion too it's an improvement. I presume some people have said it was a "waste of time" because currently there are more important issues/bugs in DMD.


In the meantime I have underlined a second small idea from Clang that I think will be useful to implement in D/DMD too, the use of "aka", this is an example from Clang:

t.c:13:9: error: member reference base type 'pid_t' (aka 'int') is not a
structure or union


This is a wrong D2 program: 


void main() {
    alias int Foo;
    Foo f;
    f = f.x;
}


DMD 2.049 prints:
test.d(4): Error: no property 'x' for type 'int'

But a more useful error message may be:
test.d(4): Error: no property 'x' for type 'Foo' (aka 'int')

In a tiny program like that the difference doesn't show much, but as programs get bigger, and alias is more far from its usage, it will be useful.

The enhancement request:
http://d.puremagic.com/issues/show_bug.cgi?id=5004

Bye,
bearophile


More information about the Digitalmars-d mailing list