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

Also add the need to write shed loads of "test code" in order to reduce the probability of runtime fatal errors that would have been caught by a compiler

People always say this, and I've never understood it. Can somebody provide an example of a test that you "have" to write in a dynamically typed language that you wouldn't with static typing? If you're referencing nonexistent properties, then any test that hits that line will fail, and such a test should exist regardless of whether you're using static types.



No, that's exactly the point: with a statically-typed language, you wouldn't need a test for a non-existent property reference. The compiler will choke on the bad reference, and any test that uses/references the module in which the code resides will fail to compile. In other words, just simply trying to compile the complete codebase serves as a baseline "type/sanity test". The compiler will simply not allow you to produce an application containing such code.




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

Search: