You are a stupid programmer, you can't have that

IGotD- nise at nise.com
Sat Aug 7 12:15:15 UTC 2021


This is a general discussion which applies to all computer 
languages and also under several decades. What I have observed is 
that language designers see programmers misuse the language and 
introduce possible bugs and therefore remove features in 
languages. An analogy would limit the functionality of cars 
because people sometimes are involved in accidents, like 
automatic speed limiter (soon to be law in several countries).

Language designers seem to have a big brother attitude towards 
programmers and think they will save the world by introducing 
limitations.

Examples.

1.
Array indexes should be signed instead of unsigned because 
somehow programmers mess up loops among other things. Bjarne 
Stroustrup considered his unsigned index to be a historic 
mistake. While unsigned array indexes make perfectly sense, the 
bias towards signed seems to be that programmers are stupid. The 
question is, if can't make a for loop with unsigned math, 
shouldn't you look for another job?

2.
Somewhat related. when Java was designed, the designer (James 
Gosling I believe) claimed that programmers were too stupid to 
understand the difference between signed and unsigned math 
(despite often several years of university education) and removed 
signed math entirely from the language. The impact is that when 
unsigned math is required, you are forced to conversions and 
library solutions. Not ideal when an HW APIs deals with unsigned 
numbers for example.

You are welcome to add any other examples that you find 
significant for the discussion.


This partially applies to D in some extent but can often be found 
in other languages and mentality of several language designers.

The question is, do you think language designers go to far when 
trying to "save" programmers from misuse or not?
Do you think there can be approaches that both prevent bugs at 
the same time do not limit the language?



More information about the Digitalmars-d mailing list