Live data from Hacker News

“Mostly functional” programming does not work

queue.acm.org

31–40 of 58 posts

Re: “Mostly functional” programming does not work

#31
post #14

Earlier quoted context omitted.

After reading the article I tend to agree. Just this excerpt seems to confirm: Pure functional programming is programming with mathematical functions. ... Calling a function with the same arguments will return the same result every time. That leaves a whole lot of other functions, the non-mathematical ones, the real-life ones where you read files or I/O or user input out of the "Pure" definition, if I understand it c…

I believe the whole fuss of monads is because they allow you to write pure functional programming while still doing I/O and similar things. http://chris-taylor.github.io/blog/2013/02/09/io-is-not-a-si...

Ok, but if we're being picky about things, you can use all the monads you want, but if you read a file and display its output two different times, you may well get completely different results. The contents could have changed, someone may have removed the file, and so on.

Re: “Mostly functional” programming does not work

#32

The author needs to be less aggressive in the accusations. This current trend which supposedly "doesn't work" actually runs the vast majority of the modern web consistently and reliably. Placing onerous restrictions on what someone is permitted to do in order to satisfy some formal abstract programming model - that is the thing that really doesn't work too well. This makes arbitrary programming arbitrarily difficult:…

Which functional language prevents you from passing buffers by reference? Edit: I see there are quite a few. Please tell me about one :)

[deleted]

Re: “Mostly functional” programming does not work

#33
post #5

To play devil's advocate for a minute: Nearly all useful, reusable software today is written in a mostly or entirely imperative language. This is despite the fact that functional programming has been around for at least 20-30 years. So, my basic question is, if functional programming is so much better, why isn't more software written in a functional language? Or put another way, why are there so many blog posts promo…

That's a good question and a proof that pure FP isn't good for creating "stuff that works". For years the mantra was "bad industry doesn't want to use FP". But nowadays, especially inside a community like HN, this statement doesn't make much sense. There are plenty of side projects and startups, and how many of the successfull ones use pure FP?

I think the reason for this is that pure FP replaces classic programming with puzzle solving. It satisfies math-oriented minds by forcing usage of this math-oriented layer. But it looks like software isn't math and you often need to work with a computer in a more direct way.

Re: “Mostly functional” programming does not work

#34
post #5

To play devil's advocate for a minute: Nearly all useful, reusable software today is written in a mostly or entirely imperative language. This is despite the fact that functional programming has been around for at least 20-30 years. So, my basic question is, if functional programming is so much better, why isn't more software written in a functional language? Or put another way, why are there so many blog posts promo…

This article is about pure functional programming.

As for functional programming, all of the recent languages (Rust, D, Go, Clojure, Scala, etc.) have functional features such as lambda functions. I don't think it's a stretch to say lack of support for functional programming is not an option for new languages.

As a couple of examples of software written in a functional language, consider Twitter and (ironically) Hacker News.

Re: “Mostly functional” programming does not work

#35

Earlier quoted context omitted.

Alright ... I didn't mean this to be confusing ... here I'll remove that --- I was referring the whole class of languages which are more driven by purist theory than by practical need. There's quite a few that only support pass-by-value intentionally

C only supports pass-by-value (unless I missed something recent) and it's generally not considered a pure functional language.

C lets you make pointers to arbitrary things, so even if you somehow had a value containing your 1GB buffer, you could pass a pointer to it instead of copying it around.

Re: “Mostly functional” programming does not work

#36
post #5

To play devil's advocate for a minute: Nearly all useful, reusable software today is written in a mostly or entirely imperative language. This is despite the fact that functional programming has been around for at least 20-30 years. So, my basic question is, if functional programming is so much better, why isn't more software written in a functional language? Or put another way, why are there so many blog posts promo…

It does produce results, but the results are probably more hidden. Rumor has it that 50% or more of all telecommunication uses Erlang, a mostly-functional programming language. This is a tremendous success, but few people know of the fact.

I like to think that the whole discussion is straw-man. The useful, reusable software can be created in any language. But when every project is a gamble, and most projects starts out as imperative in orientation, then the chance of those bubbling to the top is greater. Good modularity of software happens on a higher level than picking the programming language of choice.

Re: “Mostly functional” programming does not work

#37
post #14
post #5

To play devil's advocate for a minute: Nearly all useful, reusable software today is written in a mostly or entirely imperative language. This is despite the fact that functional programming has been around for at least 20-30 years. So, my basic question is, if functional programming is so much better, why isn't more software written in a functional language? Or put another way, why are there so many blog posts promo…

After reading the article I tend to agree. Just this excerpt seems to confirm: Pure functional programming is programming with mathematical functions. ... Calling a function with the same arguments will return the same result every time. That leaves a whole lot of other functions, the non-mathematical ones, the real-life ones where you read files or I/O or user input out of the "Pure" definition, if I understand it c…

This logic oversimplifies: you are making the assumption that a function that talks to the outside world, such as 'read', is the same function at every invocation. You can deal with outside events (viz. IO) by using and returning a different 'read' function every time. Similarly, you can simulate state by feeding back a state object as an argument to the next invocation.

Re: “Mostly functional” programming does not work

#38

Earlier quoted context omitted.

Alright ... I didn't mean this to be confusing ... here I'll remove that --- I was referring the whole class of languages which are more driven by purist theory than by practical need. There's quite a few that only support pass-by-value intentionally

C only supports pass-by-value (unless I missed something recent) and it's generally not considered a pure functional language.

sorry ... it's 340 am ... i'm screwing up my english. alright ... i'm going to stop replying.

Re: “Mostly functional” programming does not work

#39

I use Scala for "mostly functional" programming, and it works very well. Sorry, Erik, you are just not where it's at anymore.

Happens to be that Scala is Erik's favorite as well.

I must say that the article has a completely different tone than when you'd talk to him personally, though he likes to talk in extremes and only afterwards talks about what is practical yet not in a diminished importance kind of way. I interpret the article just as a big indicator to a fundamental problem how we can express stuff in language and their accompanying downsides.

Re: “Mostly functional” programming does not work

#40
post #31

Earlier quoted context omitted.

I believe the whole fuss of monads is because they allow you to write pure functional programming while still doing I/O and similar things. http://chris-taylor.github.io/blog/2013/02/09/io-is-not-a-si...

Ok, but if we're being picky about things, you can use all the monads you want, but if you read a file and display its output two different times, you may well get completely different results. The contents could have changed, someone may have removed the file, and so on.

Mathematically, you have two different inputs in that case, the environment changed since.
Post reply on HN