Hacker News new | past | comments | ask | show | jobs | submit login

> Folks who prefer dynamicly-typed languages are generally of the opinion that working with compiler error messages sucks.

This is not at all why I prefer dynamically typed languages. Try doing some JSON parsing in Haskell for a non-trivial payload (like something with nested objects) without wanting to pull your hair out.




I've been doing exactly this, and lenses make this pretty painless:

https://github.com/rocurley/Nations-Graph/blob/master/Nation...


It doesn't have to be like that just because the language is compiled, though...for example, Elm's JSON parsing is quite nice: http://elm-lang.org/blog/announce/0.14#making-json-easier


I can't tell from those examples if it's good or not, the json shown is all trivial 1 level deep json that you rarely encounter in real life. How it handles nested objects and array, deeply nested objects and arrays is what I'm interested in. Not the ability to handle a Point payload. I know in dynamic language it's typically a 1 liner. I'll endure a little more work than that, but my experience from Haskell was quite painful.


Good point. Small nitpickery, compiler is not equal to statically typed.

Counterexamples: Common Lisp is dynamically typed, OCaml and Haskell are statically typed. All three languages have both compilers and interpreters.

(Some crazy persons even wrote C interpreters, for what it's worth.)


That's much less a function of static typing, and much more a function of immutability. There are programming constructs to help with that (such as lenses, mentioned in another comment), but there's also nothing stopping you from writing very compact statically typed code that mutates a value three levels down in a JSON tree, if you had a mutable data structure.


Have you tried https://github.com/bos/aeson? It's extremely fast and also quite easy to use.


Its an upfront cost for sure, but it more than pays out throughout your program later as you have guarantees for the shape of the data




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: