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

Don't generalize, they're hard in different ways.

C++ is hard like tiptoeing across a minefield is hard. "Don't forget to make destructors virtual! Use auto_ptr! But don't put it in an STL container! Don't subclass the STL containers! Watch out for that implicit copy constructor!"

I found Haskell to be hard like trying to take a walk in the fourth dimension would be hard. "Okay, I want to do I/O, wrap that in a monad. I want to use the Parser monad too, Parsec is so nice! Ok, now I need a monad transformer to work with the I/O and the Parser. Oh yeah, and I want to pass a State around, another monad. How do I get anything done at all with all these monads?!" It was fun writing pure functional code in Haskell, real world interaction seemed to melt down into a horrible mess.

I think the true easy languages are Python and LISP, mostly because they're consistent and pragmatic. Even C or Java are easier to use than C++ because they're more consistent and predictable.




Nice minefield metaphor. I usually call C++ a pointless annoying trivia contest but I really like the image of a minefield. Maybe programming in C++ is like a game show where if you get all the answers right the grand prize is not having to go in to work every weekend for a month to hunt down memory leaks but if you get even a single one wrong you have to walk through a minefield while a bloodthirsty studio audience cheers you on.

"Oops, sorry contestant #1. You forget to say that what you were deleting is an array. Since your code compiled you can still stay in the game by walking across that minefield."

Step, step, pause, step, pause, breathe deeply, step, step, KABOOM!


Parsec is indeed a pain in the behind -- it could have been written as a monad transformer (with the current version implemented as a transformation of the Identity monad). It takes a bit of work to make a monad transforming version out of the Parsec source code, a bit more if you want to generalize it out to support parsing byte vectors (as opposed to linked lists of characters) or other things, and overall it's just a pain, and you end up with three monad transformers atop one another, if you do it "right." So then you think, "ok, I'll just make a general parsing typeclass so I can newtype derive solid parsing types," and then boilerplate instances begin, and that takes O(n^2) code overall, where n is the number of monad transformer typeclasses you want to have playing nice with each other. And don't get me started on functional dependencies.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: