Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

His example for the second point is horrible and contrived (not to mention stringly typed, which is an anti-pattern in every language). If anything, the "unhandled" should be assigned in and "else" block, not by implicit "fall-through". That would (probably, I don't know R) cause a failure for an undefined variable when trying to return it - which is exactly the same as having the compile complain about an undeclared variable.

In general, I just disagree. Strictly typed just isn't superior to dynamic typing at all. It's a different approach with its own pitfalls, and more than enough of them.



The final else block is a good point. In R this would cause an error during the attempt to return a non-existent variable (so at least R doesn't form a new variable on reference, just on assignment). This better is you now can see the error if it occurs. But it isn't everything as you may see this first in production (if you have insufficient testing). I still like the bug to not be at all possible. For example in Java we could declare the variable final at the top of the block and then the compiler would only accept code where the variable is assigned exactly once on all code paths (no matter how unlikely the path). This would catch a bunch of other popular errors (like forgetting to type "else" before one of the chained "if"s (as "else if" is unfortunately just a convention).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: