4 ms·
Hmm, I found some of the criticism unfair. E.g. the example with "baz = foo->bar(3);". Yes, "bar" could be a number of things here, but that's why variable nam
by karterk 14y ago
Hmm, I found some of the criticism unfair. E.g. the example with "baz = foo->bar(3);". Yes, "bar" could be a number of things here, but that's why variable naming conventions help.
The point about operator overloading is accepted, but this is not too different from what happens with metaprogramming in Ruby or say macros in lisp.
Even python has some quirks. See: http://stackoverflow.com/questions/1132941/least-astonishment-in-python-the-mutable-default-argument http://stackoverflow.com/questions/1132941/least-astonishmen...
- jrajav 14y ago> Hmm, I found some of the criticism unfair. E.g. the example with "baz = foo->bar(3);". Yes, "bar" could be a number of things here, but that's why variable naming conventions help. Then why must variables have static types?
- AnthonyMouse 14y agoWhat does one thing have to do with the other? Static typing reduces runtime errors by requiring you to be explicit when you want a nontrivial type conversion. There are entire classes of errors and security vulnerabilities that come from poor type checking. SQL injection is purely a result of SQL not requiring type information, which causes the SQL server to be unable to properly distinguish between the end of user-provided data and the start of the next statement, foisting that task onto the programmer who neglects it at his peril.
- mpyne 14y agoStatic types exist for the compiler to aid the programmer in discovering errors. Naming conventions (in c++) exist for the programmer to aid the programmer in recovering the semantics of a given expression (which the compiler already understands).