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

>Statically type languages prevent a lot of bugs

Correction:

Statically typed languages prevent a lot of the bugs that total beginners to programming would make; while they are useful in preventing the one, two or tree trivial, easy to solve bugs that a seasoned programmer would make once in a week.

They are also not useful at all to prevent the real-life, critical bugs that have nothing to do with types at all, and that are the ones that will negatively impact the product the most and will take serious time to get fixed.

You know what static typing is good for? It has nothing to do with "preventing bugs". It has to do with performance and compiler optimizations.



> They are also not useful at all to prevent the real-life, critical bugs that have nothing to do with types at all,

Most bugs are about types, just most languages’ type systems are too weak to express the logical types relevant to many important bugs (and, if they weren't, then you'd probably have to worry more the about bugs in the type-level code.)


> Most bugs are about types, just most languages’ type systems are too weak to express the logical types relevant to many important bugs

Ok, so you are writing a function for a fast approximation of ATANH using IEEE floating point standard.

In type: IEEE floating point number

Out type: the same.

The function will report an incorrect value (bug), yet still be perfectly type safe.

Tell me how the magical type checking of the super-good-type-system programming language you propose will catch the error and thus prevent the bug.

And also, we're discussing about real-life problems, tackled with existing programming languages, not languages that don't exist yet.

Not even Haskell, with it's great type system, will help you in such cases. Not in the bugs that are caused by a flawed understanding of the business model, the business rules, or of the system as a whole.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: