Bug 4070 and so on

bearophile bearophileHUGS at lycos.com
Mon Apr 5 11:33:07 PDT 2010


I am not the only one to ask for small breaking changes that have the purpose of tidying up the language! :-)

Days ago I was thinking about a possible new enhancement request, but  Simen Kjaeraas and Steven Schveighoffer have written it before me.

The meat of this enhancement request is simple: it asks to turn the placing of const/immutable of class/struct/union methods on the left into syntax errors (there are other alternatives, but this can be the best). See the bug report 4068 and 4070 for more details.

I strongly suggest Walter and Andrei to take a better look at similar tiny proposals to tidy up the language (some of such proposals are wrong, of course), because it's good and dandy to disallow in D valid C code like:

for(int i = 0; i < 10; i++);

Because that's often a bug, and require:

for(int i = 0; i < 10; i++) {}

Walter is an expert of writing C code, so he has designed D to avoid such C traps. But D introduces *many* other constructs and features missing in C, and they too can contain traps. So it's much better to design D to avoid them too. Otherwise for each C trap that D avoids, D can introduce two or three new traps :-)

I'll keep banging on this point in my future posts because this is one of the most important things for D, more important for example that making D go well with concurrency. Because D must be safe&tidy first of all for basic serial code :-) There's no hope of writing reliable concurrent code if basic constructs have traps or their design has small holes. Not every little hole can be fixed, but we can try to fix as many of then as possible.

Bye,
bearophile



More information about the Digitalmars-d mailing list