Hacker News new | ask | show | jobs
by sitkack 4113 days ago
While the result is probably correct, your argument is, odd. :)

Hammers in nails with an orange, and this folks, is how Black and Decker makes better drills than Makita.

The single reason that OCaml excels at compilers is due to pattern matching. It _removes_ all those explicit conditionals by making them implicit.

http://andrej.com/plzoo/

Python has excellent affordances for writing compilers, they just have to be used.

https://github.com/mrocklin/multipledispatch/

https://github.com/Suor/patterns

1 comments

It's not just pattern matching -- it's also ADTs and the functional paradigm. (e.g. in Python, functools.partial is uglier than OCaml's application, just as working with dictionaries is uglier in OCaml than Python)

Do those Python libraries offer type safety? I don't think there is any way they can. If not, you might as well use OCaml.

As I said, Python is my favorite language, but there is no reason to write OCaml in Python or even shell scripts in Python. Why not use the real thing? The Python code still won't be shorter than OCaml, even if you use these fancy libraries.