Tidy auto [Was: Re: @disable]

bearophile bearophileHUGS at lycos.com
Sun Jan 17 02:53:11 PST 2010


This discussion clearly shows that the current semantics of the "auto" is not clean enough and it needs to be improved.
To improve it D needs to adopt the strategy of using all attributes in a more tidy and semantically clean way, as Java does. Java doesn't compile "useless" or wrong attributes as D sometimes does.

So it can be better to this to be a compilation error:
enum x = 10;
And accept only:
auto enum x = 10;
Or:
int enum x = 10;

Such tidy enforcement of attributes can be seen as fussy and sometimes it requires extra compilations to remove all the mistakes, but it helps the programmer understand in less time the semantics of those attributes. In pedagogy it's well known that when a student is learning something, it's much better if the rules are enforced in a strict way at the beginning.

And I'd like in D2 the "override" to be always necessary (even when the code is not compiled with "-w") as in C#, to avoid other bugs. I can show an example of such possible bugs.

Bye,
bearophile



More information about the Digitalmars-d mailing list