Hacker News new | ask | show | jobs
by crazyowl 5131 days ago
No, not crash at runtime. Raise exception in runtime. You know, like NullPointerException in Java? Or ClassCastException? Or OutOfMemeoryException.

You'll have more of the runtime errors in Python, but you're not free from them in other languages either, static typing or not.

1 comments

That's true, as anybody in, say, Delphi would know, when they hard cast from one type to another.

As for the semantics of crashing vs. not crashing, that is a different argument entirely. Do you want your code to suppress a SyntaxError or TypeError exception and "keep going" - probably not? But maybe? It all depends, I suppose. You'll let the unhandled and unexpected exceptions percolate to the top of the stack and then your "main" method will decide what to do next. But putting square pegs into round holes do happen, and the question then becomes: how do you ensure that does not happen as often?

I never made the argument that languages like C#, Ada, Delphi, or Java were immune from runtime errors. Not at all.