On 01/17/2010 11:53 AM, bearophile wrote:
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
huh, you want to ditch type inference?
Java may be strict or even clean, but of all programmers I know, there
are just one or two that do not hate that language with a passion and
one of the reasons is this pedantic verbosity.