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

cy dlang at verge.info.tm
Mon Aug 9 01:37:09 UTC 2021


On Saturday, 7 August 2021 at 12:15:15 UTC, IGotD- wrote:
> Array indexes should be signed instead of unsigned because 
> somehow programmers mess up loops among other things.

This bugs me to no end. It is not hard to understand the concept 
of `idx < size()` and anyone using `idx < size() - 1` should take 
a remedial course in basic Algebra, rather than fixing my 
language by not allowing me to say unsigned things. It's just not 
hard to remember to always use "less than" and "size" in your for 
loops. Reverse for loops are really the only exception, and 
that's just 1 more thing to remember `for(top=size(), top > 0; 
--top) { auto idx = top - 1; ... }` repeat for every program ever 
exactly the same way.

I can accept a language that doesn't let me use unsigned 
arithmetic though, even if I grumble about it. I do approve of 
stuff that limits subtle errors in rarely encountered, esoteric 
situations, like how you can't have a multi-byte character inside 
a 1 byte literal. What really is a bad idea is stupid, fake 
encapsulation, that doesn't encapsulate anything and is just 
encouraging programmers to make things hard for other programmers 
purely for ego stroking, with no savings in complexity.

So basically I think the `private:` keyword needs to go die in a 
fire.

> The question is, do you think language designers go to far when 
> trying to "save" programmers from misuse or not?

I believe the technical term these days for when language 
designers go too far trying to save programmers from misuse is 
"rust."


More information about the Digitalmars-d mailing list