Hacker News new | ask | show | jobs
by donatj 2395 days ago
You really don’t get most of the benefits “Strongly typed” languages here. A program that fails with type errors at runtime instead of compile time is the worst of all worlds.
4 comments

Continuing to run with unexpected type coercion bugs could be worse than bailing out. So, worse than compile time checking, yes. But not the worst.
It just seems to imply that you need input validation code regardless of how your language is typed.
> A program that fails with type errors at runtime instead of compile time is the worst of all worlds

Better than silently failing! + if code fails early as these type checks can enable, then bugs are often (not always) picked up just by running the code once.

You can use third-party tools to check ahead of time, and you can fall back on the PHP runtime to catch what can't be caught in advance.
This will help you find type errors if you have good test coverage without explicitly testing for types. Makes tests shorter.