sbyte

bearophile bearophileHUGS at lycos.com
Sat Mar 27 05:20:11 PDT 2010


I can add something to this long thread.

I don't like C octal literals for aesthetic reasons, because in mathematics leading zeros before the decimal point are not significant. Programming languages are not forced to follow math notation conventions, but experience clearly shows me that when possible it's convenient to follow math notation because it's widely known, by newbie programmers too, and expert programmers to know it well, sometimes from primary school, so it's well interiorized. That's why for example the missing operator precedence rules of Smalltalk are bad. So I think C octal literals are bad-looking small traps that a modern language is better without. If octal literals are seen as useful, then a better, more explicit and safer octal literal can be invented. This is what Python3 has done, and this is what I think D should do. This is what I have asked in bug report 3837.

On the other hand no octal number has ever caused a bug in my Python2.x or D programs, and I think it has caused no bugs even in my C code. So despite being little traps for me they are not so bug-prone.

On the other hand, the name of signed bytes has caused one or more hard-to-find bugs in my D code. I have never put such bug in Delphi/C programs (but in C the signedness of chars has caused me few troubles in the past. Thanks Walter D chars don't come in signed and unsigned versions, avoiding that chars bugs, and introduces bugs on bytes...). It's not just a matter of bug count: D forces me to keep some of my attention on the signedness of bytes when I program, this slows down programming a bit and distracts a small part of my attention away from the things that truly matter, that is problem solving, the things that the program has to do, etc. So I think on this D is worse than Delphi/C, and deserves to be fixed.

My D1 dlibs are something like 80-90 thousand lines of code, and then there is all the code that uses those dlibs, so I have probably written 250_000 or more lines of D1 code, this can be more than the D1 code written by Walter. So I am able to see what things in D1 have caused me bugs or require some undeserved attention to write bug-free code.

Bye,
bearophile



More information about the Digitalmars-d mailing list