digitalmars.D - Bug 4070 and so on
- bearophile (11/11) Apr 05 2010 I am not the only one to ask for small breaking changes that have the pu...
- anonymous troll (2/3) Apr 05 2010 But Trap Oriented Programming produces the TOP coders =)
- bearophile (4/4) Apr 06 2010 While my original gut feeling was that Steven Schveighoffer is right abo...
- bearophile (6/6) Apr 11 2010 Thinking some more about Bug 4070 I can add:
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
Apr 05 2010
bearophile Wrote: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 :-)But Trap Oriented Programming produces the TOP coders =)
Apr 05 2010
While my original gut feeling was that Steven Schveighoffer is right about bug 4070, I can't really know what the best design solution is, Walter has lot of programming experience so Steven can be wrong (but in my D2 programs I'll always put the const/immutable on the right of the function, and I think Andrei usually does the same). The main point of my post was that there are few tiny things like this one that deserve a short discussion. So thank you Walter for taking a look at this issue, regardless what the final decision is. Bye, bearophile
Apr 06 2010
Thinking some more about Bug 4070 I can add: A possible piece of the Zen of D language: Special cases in the language are bad, but sometimes they can be acceptable if they turn a consistent behaviour that can lead to mistakes/bugs into a good compile-time error. An example of this is disallowing: for(int i;i<10;i++); Eventually we can collect a short D Zen. Bye, bearophile
Apr 11 2010