Live data from Hacker News

Pissed off about functional programming (2005)

perlmonks.org

11–20 of 65 posts

Re: Pissed off about functional programming (2005)

#11
post #6

I think his argument held more weight in 2005. Even though Haskell at that point was 10 years old I dont think it was quite the poster child of FP it is today. It's my guess that he's talking about non-pure FPLs like Lisps and MLs, which today don't seem nearly as FP as Haskell, Idris, Agda, Coq - the langs that are now carrying the FP torch.

There it is. I noticed it was 2005 but didn't think of this. I was trying very hard to understand statements like:

>Now.. with those definitions in place, you can see how the relationship between simultaneity and lazy evaluation isn't quite as simple as it appears at first glance. It's theoretically possible that the 'f()' or 'x' might change between the lazy evaluation of step one and the lazy evaluation of step three million. Trying to prevent that is what we programmers call a 'hard' problem.

It only makes sense if you don't consider Haskell to be the most immediate example for lazy, purely functional programming.

Re: Pissed off about functional programming (2005)

#12
>> I just had an long and very frustrating conversation with a young programmer who recently discovered functional programming, and thinks it can solve every problem in the world.

I'm struck by A) the arrogance of such a statement, and B) how completely unsurprised I am by it. The fact that the rest of the article is nitpicky stuff of no real consequence, with a heaping helping of strawmen and goal-post moving, only supports this. This is a person who fears being wrong and is defending their turf.

For the proverbial "you", because this is an endemic problem in our industry:

It's not necessary to defend turf, both if you are right and if you are wrong. Obviously, if you are wrong, it saves you time to have someone else figure it out for you and then you can adjust accordingly (you're going to adjust once proven wrong, right?).

But if, in some weird happenstance that has yet to be demonstrated in history, you're right, you have expended no effort to defend your position. Sometimes, you have to let people learn their lessons the hard way. Let the youngsters run in their enthusiasm and trip and fall on their face sometimes. It's the only way to build a healthy fear of novelty-for-the-sake-of-novelty, and instill some critical thinking as a matter of course.

It's not necessary to be "right" all the time. Just because there are people in the world who are "Doing it Right" versus "Doing it Wrong", doesn't mean you have an ordained duty to inform them.

Because I'm really getting sick and tired of being asked "why didn't you use for that ?"

Re: Pissed off about functional programming (2005)

#13
post #5
post #4

While knowledgable sounding... I kind of feel like he was missing out on what pure FP can and does achieve. There were many statements to the effect of "don't pretend X is Y because while Y is obviously great, it's also true that any lang which does Y could not operate (here's an example in Perl)". I reject that last bit, that these things Y lead to a useless language though I do think the proof was far from the pudd…

"I kind of feel like he was missing out on what pure FP can and does achieve." So what exactly was he missing? When I was programming in FP languages, the process didn't seem all that different from other languages, except generally more cumbersome.

> except generally more cumbersome

you're doing it wrong.

Re: Pissed off about functional programming (2005)

#14
post #5
post #4

While knowledgable sounding... I kind of feel like he was missing out on what pure FP can and does achieve. There were many statements to the effect of "don't pretend X is Y because while Y is obviously great, it's also true that any lang which does Y could not operate (here's an example in Perl)". I reject that last bit, that these things Y lead to a useless language though I do think the proof was far from the pudd…

"I kind of feel like he was missing out on what pure FP can and does achieve." So what exactly was he missing? When I was programming in FP languages, the process didn't seem all that different from other languages, except generally more cumbersome.

That it's possible to write nontrivial programs using immutable data (see Clojure in particular), which makes debugging highly concurrent applications much much easier. That it's possible to achieve precise control over effects with only a moderate amount of overhead. Look at the perennial debate in Ruby-land over whether you should test at the unit or the integration level. In Haskell that's not a choice, it's clear from the very type of a function whether it's a pure function or a function that makes use of context. And when debugging this lets you rule out whole swathes of your program as areas that couldn't possibly be causing the problem (contrast e.g. in Java I've spent days tearing my hair out only to discover that a problem was caused by a bug in a getter method - by convention getters are short and simple and can't possibly go wrong, but there's nothing enforcing that at the compiler level the way there is in Haskell).

Re: Pissed off about functional programming (2005)

#15
I don't quite get why the 'Substitutability' code snippet fails? Is it because the both vars 'point' to the same RAM address initialized with '3'? If that is the case, I would argue the language is somewhat broken, or at least it`s a major caveat ... Please explain?

Re: Pissed off about functional programming (2005)

#17

Wait, since when did functional programming imply immutability? I think fifty years of lisp would like to have a few words with this fellow.

Don't all scalable modern functional languages depend on immutability? So they can move function execution to different processes/virtual machines freely. Or something.

Re: Pissed off about functional programming (2005)

#18
post #5
post #4

While knowledgable sounding... I kind of feel like he was missing out on what pure FP can and does achieve. There were many statements to the effect of "don't pretend X is Y because while Y is obviously great, it's also true that any lang which does Y could not operate (here's an example in Perl)". I reject that last bit, that these things Y lead to a useless language though I do think the proof was far from the pudd…

"I kind of feel like he was missing out on what pure FP can and does achieve." So what exactly was he missing? When I was programming in FP languages, the process didn't seem all that different from other languages, except generally more cumbersome.

He simply made a lot of assertions that certain styles of programming are impossible. That assertion feels great if you (a) don't actually know the techniques of achieving some of the benefits outlined and (b) try to program in a language that doesn't support them as well in a style which doesn't work well with them.

In some sense, despite the author's assertion that FP is mind-expanding and a great learning experience, I believe he still had a lot to learn. Mostly that most of these techniques and benefits are workable, but they take a genuine change in perspective (such as outlawing ambient state entirely).

Re: Pissed off about functional programming (2005)

#19
post #5
post #4

While knowledgable sounding... I kind of feel like he was missing out on what pure FP can and does achieve. There were many statements to the effect of "don't pretend X is Y because while Y is obviously great, it's also true that any lang which does Y could not operate (here's an example in Perl)". I reject that last bit, that these things Y lead to a useless language though I do think the proof was far from the pudd…

"I kind of feel like he was missing out on what pure FP can and does achieve." So what exactly was he missing? When I was programming in FP languages, the process didn't seem all that different from other languages, except generally more cumbersome.

"When I was programming in FP languages, the process didn't seem all that different from other languages"

Isn't there a rather famous phrase, 'You can write Fortran in any language'?

I kinda skimmed over the OP, admittedly, and the lambda the ultimate responses; I find myself far more on the side of the lambda the ultimate responses (that this guy is largely strawmanning/misunderstanding FP), but that's still immaterial to me, as I'm not really interested in academic arguments.

I've been programming in Erlang (which though not lazy nor pure still embraces an FP approach), and I've found that after embracing the languages idioms, structuring my code and my thinking to take advantage of the language, I'm far more productive than I was in any imperative language (and became so in less time than I had spent in those imperative languages). And things like concurrency, while still complex, have become comparatively trivial than the crap I was having to deal with in those imperative languages.

Now, that may be a combination of other factors (a REPL, more concise language, fewer teammates writing better code), and it's anecdotal, same as your response, but ultimately I think personal experience is going to trump academic argument every time.

No matter how much someone extols the benefits of FP, if you don't experience them you won't be swayed, and similarly no matter how academic an argument against FP someone tries to make, having experienced benefit from using a functional language, academic arguments are of little interest to me, and I'm curious to try more functional languages.

All I'd say is, to your experience, examine whether you were simply trying to bend the language to fit your existing models and approaches, or if you were willing and able to replace your models and approaches with those the language required (i.e., in Haskell, not merely "Okay, I need to do a side effect here, so time to write 'do'", but "Hmm, I have a side effect here...is this the right place for it? What other side effects do I have? Can I minimize where they're being called, so I have comparatively few functions that require the io monad?" etc). If it was the latter, fair enough. My experience was different; both are valid.

Re: Pissed off about functional programming (2005)

#20
"Even a side-effecting function call in C has a well-defined "value" as a state transformer that maps states to pairs of states and values (the so-called "monad" in functional programmers' terminology). The reluctance of functional programmers to call such languages "referentially transparent" merely implies that they are reluctant to admit such complex mathematical/conceptual objects as "values". On the other hand, they seem perfectly willing to call a state transformer a "value" when it is put in their own favourite syntax and dressed up with a buzz word like "monad". I have to say that they are being entirely inconsistent, even if we grant it to them that their idea of "referential transparency" has some coherence."

http://stackoverflow.com/a/11740176

Post reply on HN