On 10/10/2014 4:04 PM, Brad Anderson wrote:
I think it's rather unfortunate that D used keywords from C++ for things that
work differently. const in particular but struct and class cause confusion and
bickering too. Think of all the hours spent on this newsgroup arguing about
logical const. If D's const were called something else like readonly nobody
would be trying to shoehorn logical const into it and calls for logical const
would have been discussed without having to pit two features against each other
for a single spot in the language.

These kinds of problems always occur when transitioning from one language to another. I'm not trying to be dismissive, but I feel that a language has to pick its battles.

BTW, C++ const constantly causes confusion even for experienced C++ programmers.


Another is char for utf-8 code units. So many people assume a char is a
character when it's actually only sometimes a character by coincidence. If it
had a different name like utf8_unit people would probably write more unicode
correct code naturally.

C++ has the same problem, only far worse, since char is used for all kinds of multibyte characters, and most legacy/library code assumes ASCII. Java has the same issue (surrogate pairs).

There are other issues:

1. integers overflow
2. floating point numbers have precision problems

Programming languages are always imperfect models, it's like the 2x4's you buy at the hardware store are never straight. You just learn to deal with it, because perfectly straight ones would be prohibitively expensive.

Reply via email to