Live data from Hacker News

Pissed off about functional programming (2005)

perlmonks.org

41–50 of 65 posts

Re: Pissed off about functional programming (2005)

#41

Here's another myth: "Functional programming solves the concurrency problem". http://www.infoq.com/presentations/java-performance Scroll to 41:05

Has anyone ever seriously believed this? I guess it's just easier to coordinate resource sharing when resource sharing isn't allowed. My favorite is "Functional programming is becoming more relevant because...multi-core" so your 100x slower functional code would get a 4x speed up and only be 25x slower?

Here's another myth, functional code is 100x slower (than what?). Here's the counter example, Microsoft Research chose the functional first language F# to build arguably the most advanced and useful quantum computer simulator in existence. http://research.microsoft.com/en-us/projects/liquid/ There's no incentive to rewrite it in C++. It already solves real quantum computing problems like molecule simulation https://channel9.msdn.com/Events/Speakers/dave-wecker

Re: Pissed off about functional programming (2005)

#42

"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,…

You might as well say that any language takes as input The Universe and returns a new Universe (perhaps also adjusting for time, if the program gives output during the execution). See? Totally referentially transparent. But not interesting.

Like he says, the technique/viewpoint is already known in FP. But in certain languages you have more control over it than others.

Re: Pissed off about functional programming (2005)

#43

"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,…

[deleted]

Re: Pissed off about functional programming (2005)

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

Haskell was _absolutely_ the poster child of FP in 2005.

Re: Pissed off about functional programming (2005)

#45

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.

Most modern FP languages (and quite a few non-FP languages these days as well) do immutable by default, with carefully controlled explicit mutability where necessary. It's basically the flip of older traditional languages where unless specifically stated otherwise everything was mutable. Doing immutable by default encourages you to use mutability only where you really need it. Immutable references allow all kinds of desirable compiler optimizations to be implemented which leads to better performing code with fewer bugs, but it doesn't need to be an all or nothing, you can have both mutable and immutable references in the same code, it just means the mutable parts don't benefit from the same optimizations the immutable parts do.

Re: Pissed off about functional programming (2005)

#46
post #40
post #30

Earlier quoted context omitted.

I don't think people who really understand referential transparency would claim that it's impossible to give C a referentially transparent semantics. It's pretty easy. (This essentially feels like looking at the meaning of the language from "the inside" versus "the outside" if that makes sense.) There's a difference between being able to imagine such a semantics and having that semantics be in common and widespread u…

I think this is somewhat misleading. It's easy to give a semantics for a toy C-like imperative language. As far as I know, a semantics that is mostly faithful to the C standard becomes extremely complicated and requires modeling e.g. code layout in memory. The equational reasoning you get from that kind of semantics is terribly weak: essentially, only terms that have the same byte-for-byte effect on memory are really…

I think we're in agreement on content if not tone... and, honestly, I think your tone is probably closer to reasonable while mine was a bit facetious.

I said it that way to emphasize the argument that existence of a referentially transparent semantics isn't enough, though. You need extant and useful.

Re: Pissed off about functional programming (2005)

#47
post #44
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.

Haskell was _absolutely_ the poster child of FP in 2005.

Then he's not thinking of Haskell when talking about referential transparency and variable assignment, or the other points of his post.

Re: Pissed off about functional programming (2005)

#48
post #44
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.

Haskell was _absolutely_ the poster child of FP in 2005.

But Haskell_2005 presented more difficulties (and research opportunities) than Haskell_2014. It was always interesting but now it's also proven to be powerful and meaningful in a way nobody had gotten around to at that point.

Re: Pissed off about functional programming (2005)

#49
post #44
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.

Haskell was _absolutely_ the poster child of FP in 2005.

I disagree; I think, at the time, functional programmers were primarily using OCaml and various lisps. This is purely anecdotal, mind you, and haskell was definitely on the FP radar big time.

Re: Pissed off about functional programming (2005)

#50

To be fair, I've done a fair bit of Clojure and Ruby in my short career, and while it's technically possible to write Ruby code in a Clojure-esque style, it's very ugly and Ruby does not make it very easy. When you write in Ruby, use classes or you will have a headache on your hands!

After years of trying to force things in various languages and frameworks (like MVC ala Struts on top of WebForms), I've learned this simple thought: don't kick against the bricks; they don't care and you'll get hurt. If you're in Ruby, program idiomatic Ruby. If you're in Python, program idiomatic Python. If you're in PHP, get a new language.
Post reply on HN