Live data from Hacker News

Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

news.ycombinator.com

11–20 of 31 posts

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#11
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.

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#12
post #4

People enjoy programming in C++? Many people enjoy learning difficult things for the challenge of it, but no sane person enjoys using tools that remain difficult once understood. There are concepts in Haskell (and Lisp, ML, Smalltalk, etc...) that are considered difficult or confusing by the mainstream. They're also powerful , making it rewarding to learn them. Languages like C++ and Java are difficult simply because…

Some C++ wizards took Greenspun's 10th rule as a challenge and developed template metaprogramming libraries like Loki and Boost :P

Its kind of interesting to observe how C++ typelists do compile-time metaprogramming, they use a cons linked-list of types in templates. Its kind of sad to watch though because there's no REPL to set the cons free.

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#13
post #6

Alright I admit it, I'm one of these crazy people. I've been programming in C/C++ since junior high. It was the second language I learned (the first being Pascal.) I guess because of that I never really saw it as "difficult." Everything is at least somewhat difficult when you're just starting out. Since C was one of the first things I learned that's where all my intuition about languages came from, so everything seem…

C is not C++. You sound like a C programmer more than a C++ programmer.

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#14
post #13
post #6

Alright I admit it, I'm one of these crazy people. I've been programming in C/C++ since junior high. It was the second language I learned (the first being Pascal.) I guess because of that I never really saw it as "difficult." Everything is at least somewhat difficult when you're just starting out. Since C was one of the first things I learned that's where all my intuition about languages came from, so everything seem…

C is not C++. You sound like a C programmer more than a C++ programmer.

Nah, I use C++ features pretty heavily. I'll even admit that I use Boost. I use STL when possible, because it's usually more efficient than hand coding and saves some time on implementing common algorithms.

C++ gives you the ability to put together really powerful frameworks to work with, but deep within the code you're still working with the same fundamentals.

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#15
Programming in Haskell is not difficult. It is easier to program in Haskell than it is in most other languages, or at least the ones I know of. I don't find Haskell particularly interesting for any of its so-called mind-blowing features, it's just a practical programming language that lets you get stuff done and communicate your intent to the computer.

I do not want the programming part to be harder.

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#16

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…

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.

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#17
post #6

Alright I admit it, I'm one of these crazy people. I've been programming in C/C++ since junior high. It was the second language I learned (the first being Pascal.) I guess because of that I never really saw it as "difficult." Everything is at least somewhat difficult when you're just starting out. Since C was one of the first things I learned that's where all my intuition about languages came from, so everything seem…

Part of it, for me, is that you know a C++ version is the /final/ version, it's as fast and efficient as it can be. It's canonical, you won't have to do it again.

But if you have to do new features, you're screwed. So, yeah, I guess it is the final version...new ones are such a pain. (I don't dislike C++. It's fine for systems-level programming. But I'm not using it for anything else.)

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#18
post #10

Better question: why do people continue to waste time starting language advocacy wars, when they could be learning new languages?

I think you'd get more interesting answers if the question were asked like this: Why do people discuss the relative merits of programming languages instead of spending that time learning a new one?

As currently stated, it's loaded with presuppositions that are hard to overcome if you want real answers. (eg: This post is language advocacy, language advocacy is a waste of time.)

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#19
post #10

Better question: why do people continue to waste time starting language advocacy wars, when they could be learning new languages?

Why is it so important to learn new languages all the time? Wouldn't you rather just get your startup going as quickly as possible?

The implementation is not inherently interesting. It's just a means to an end.

Re: Why do some people like difficult programming languages such as C++ and Haskell? Here's my theory...

#20

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…

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!

Post reply on HN