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

I tend to find the strongest proponents of static typing are the least familiar with dynamic languages


I tend to find that the strongest proponents of dynamic typing are the least familiar with good static type systems.


I don't know. I have an equal (equally small :() amount of experience with both. And, amusingly, I've disliked both.

What I found after using Java, Gosu (basically Java but less stupid), Python and JavaScript fairly significantly is that all of them have their own problems. In that particular set, I'd probably value a static type system a little more than a dynamic one, but it gets eclipsed by other language characteristics (e.g. support for functional programming).

In fact, thanks to being scarred by Java, for the longest time I really liked dynamically typed languages more. However, I later realized that it was the lambdas and the higher-order functions and the clever abstractions and the terseness that I liked more than the dynamic typing.

Once I learned Haskell (and later OCaml), I've been converted to liking static typing quite a bit. The beauty in these two languages is not just that the type system catches more bugs than Java's while being less of a burden, but also that they type system can actually make the code more expressive.

My favorite example of this is the read function from Haskell. It is the opposite of toString--it goes from a String to some value. However, the really awesome thing is that you do not need to explicitly specify what type to parse to--the type inference can figure it out for you! Imagine being able to use "5".fromString() the same way you use 5.toString(). In a dynamically typed language, you would have to somehow specify what to parse to explicitly. So your fromString code would something like Integer.fromString("5"), which is less nice and throws away the toString/fromString symmetry.

I have about the same experience with dynamic (Perl, Scheme, JavaScript, Python) and static (Java, Gosu, Haskell, OCaml) languages and I like good static typing most.

Long story short: use Haskell!


I lived almost entirely in Ruby from about 2003-2010. Going back to statically typed languages for iOS development has reminded me now nice it is to let the computer catch all my trivial mistakes.

On the rare occasion you really need the kind of anything-goes dynamism of Ruby/Python/JS you can just roll your own dispatch tables.


I work daily in dynamic languages. It cuts both ways.

I don't think it's a big deal.




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

Search: