4 ms·
In a statically-typed language, I couldn't have used a Boolean as the condition of an if-statement.
by Darmani 15y ago
In a statically-typed language, I couldn't have used a Boolean as the condition of an if-statement.
- jmount 15y agoI like the point. And not being able to use if(0) (as in C) has caught tons of bugs (like writing "if(x=0)" instead of "if(x==0)"). There are ton of things that sounded convenient in the early history of programming languages that are really anti-patterns. For example: Confusing ints with booleans. Confusing ints with pointers (no longer done, thank goodness). allowing assignments to have a non-void type ("x=1.0" should be of type void, not type double). Poor choice of assignment and test equals (would be nice not to use "=" but to force ":=" and "=="). Pverly aggressive type coercion and autoboxing. Integer division using the same symbol as floating point (many end-users want 5/2 to be 2.5 as the answer, mostly you want it to be 3 if you are doing loop-foo). Making "else if" and if-braces mere convention. Allowing null way too many places. Automatic variable decleration.