Similar to OOP, which promised to do this by encapsulating state, FP promised to do this via purity, aka. getting rid of as much state as possible, and only allowing stateful transition at certain well defined sections of the program.
The "market advantage" of OOP was that, via Java, it was already so well established, and so many coders had been trained in OOP languages, that it remained alive. FP on the other hand, coming out of academia and requiring all these industry people to suddenly do things in syntactically and conceptually different ways, never really gained traction. OOP simply came first, it is as simple as that.
Whether FP would have actually solved the problem is anyones guess, since it never gained the traction of OOP and Procedural languages. My best guess is that it wouldn't, because I don't believe in silver bullets.
It should be noted that both approaches contributed valueable things to contemporary languages. E.g. first order functions being the norm comes from FP.
Not really. Lisp is a functional programming language and has existed since at least 1960. Some claim there were many other proto-functional languages since the early 60's, and the FP language [1] (a clearly functional programming language and the result of the famous paper "Can Programming Be Liberated From the von Neumann Style?") appeared in 1977 - was inspired by much earlier efforts like APL.
OOP really only became a thing with Simula in 1967, but was not popular until the 1980's with Smalltalk and Common Lisp's Object System (CLOS) came about (so yes, there was a OOP/FP hybrid already decades ago), and then C++ and finally Java much later... at which time Functional Programming languages already included Miranda (1985) which later evolved into Haskell, and Erlang (1986). That is, FPP languages were at least as common as OOP languages by the 80's.
As far as I know, however, pure functional languages were not really very efficient until Haskell came about, while OOP languages were nearly on par with procedural style: which mattered a lot in 1980's machines.
*sight*
Okay, let's dot the i's and cross the t's then, shall we, and include languages used long long before software development became the industry behemoth it is today.
You're right. There, I said it. You are absolutely right.
Many of the concepts of functional programming were indeed pioneered in LISP, and it was indeed specified in 1960, 7 years before Simula.
But hey, let's dot another "i" and correct my statement. Because, FP isn't in contrast to OOP so much as it is in contrast to imperative programming, and all it's mutable state, right?
So, is there an imperative programming language, older than LISP, and still in use today? And the answer is: Of course there is ;-)
No it isn't, because the history relevant for this question doesn't begin at the very start of programming. Most programmers active today didn't go to university in the 60s. In the timeframe relevant to answer this question, the people were indeed confronted with OOP languages, and FP languages were already a niche topic, end of story.
This also coincides with programming, as an activity, massively gaining in popularity across many industries.
Real FP means referential transparency and that started with languages like Miranda and later Haskell.
What many people consider "FP" today is in fact just procedural programming with higher order procedures and lexical closure.
A lot of early FP teaching was done in Lisp. Some kind of "Pure Lisp" was used, which are imaginary subsets of Lisp, restricted to side-effect-free, non-destructive functions.
FP started quite a bit before Miranda.
When you write Lisp, you're mostly composing functions. It's truly very functional, just not purely functional which is probably the motivation behind your refusal to include Lisp in the functional programming language family, which would horrify the founders of the field as it's a simple attempt at redefining a widely used, well understood term to become a small subset of it for reasons of gatekeeping what we should, according to you, include under the term without any real technical reason behind it.
Many functional zealots aim for a purity beyond all reason and comprehension. When what you really want is something like Erlang/Elixir or even C#.
With the advance of lifetime analysis, mutable value semantics, and local mutability, there’s no need to ban mutable state outright. The push for functional programming will be waning in regarding to purity.
Why / why not?
The other major neat thing about functional languages is how they let you treat functions like objects, but most modern programming languages have adopted that as well, so it's not a big differentiator anymore.
It's definitely a different way of thinking and it has a lot of benefits. However, some of the downsides (which Flix seems to fix with region-based local mutation) might be implementing a sort that keeps two copies of a list in memory just to return the second list and discard the first. Depending on your list, this may not be an issue.
In theory, writing in a functional language that allows only "pure" functions (aka. functions w.o. side effects), makes it easier to control state.
In practice, side effects exists and are required for programs to do anything useful.
In my opinion, one mistake of many purely functional languages was to be so focused on this purity, that it made it needlessly hard to write useful code in them, especially for people coming from an imperative/procedural/oop style of doing things. And you need these people if you want your method to gain traction, because the vast majority of code written, is imperative.
The irony is, that FP could probably have had a lot more success if it didn't clamour on about pure functions so much, and was less focused on implementations (aka. languages) than on methodology (aka. coding style) Because it is perfectly possible to write pure functions in most languages, including OOP language, even if those functions are not "pure" internally, or are not "pure" all the time and under all circumstances.
And yes, doing so has really nice advantages. I have refactored quite alot of codebases into using a more functional approach, and what I found was that this makes it harder to introduce bugs, makes it easier to track bugs, and makes it easier to reason about my code.
So yeah, functional programming, used if and where it makes sense, does work, and is useful.
Except functional languages like Lisps and the MLs never were pure, the only (used by a significant number of people) has been Miranda/Haskell (ignoring Coq and the other proof assistents). Or, to put it in other words: ML (no, not that ML) turned 50 this year, Scheme is oder than 50 too and Miranda/Haskell ~36. There never had been a shortage of "impure" functional languages since OOP existed.
So maybe it's time for FP as a whole to accept the fact, that there seems to be something fundamental about the way it's paraded implementations look and feel like, that puts off a lot of programmers.
Maybe it's time for FP to accept that the paradigm as a whole has a lot to contribute that is useful to everyone, but doesn't need a new language with largely different syntactic constructs to do so.
Many languages are in use for different things without the need for a language to win. It is a bit anthropomorphic to approach tools like that IMO.
Instead, there has been a healthy influence of more research FP languages into mainstream languages (as you mention), more interesting experimental languages, etc. Aka everything working as intended.
Insofar as it didn't prevent the good parts of FP to become mainstream features, I agree.
But the popularity contest IS important for language emergence. I still believe there would be a place for a functional language that strives to adhere to the principles more stricly, and that programming could benefit from such a language gaining a lot of traction. But, as mentioned before, if such a language requires people to deal with a very different syntax, or applies it's principles too rigidly, it will likely fail the popularity contest.
It also is important for paradigms to become pervasive. As I mentioned, FP has a lot to teach even to OOP people. Writing functional code is a great way to organise a program.
But tell that to a young software developer who has only ever been served enterprise spaghetti OOP pasta with extra abstraction sauce garnished with pseudo-encapsulation cheese, and for whom "functional programming" is something he only saw ridiculed as a meme on some subreddits.
No, popularity isn't the only important thing. But it can help things to reach their potential.
Note that there are many functional languages which don’t care about purity at all: for instance, Scheme, OCaml, SML and Elixir. I get annoyed when people confuse Haskell for the broader paradigm of functional programming. (Even though Haskell is my main programming language!)
But people tend to avoid the name "procedural" at all cost - which is bad because procedural programming really has it's advantages and should be clearly separated from FP which also has certain advantages.
If you declare a function effect-free, and try to perform effects inside it, then you'll get a compiler error.
You are still allowed (and it's common practice!) to declare your functions as effectful.
Unfortunately the 'signal' of this message is often lost in the noise: For every Haskeller happily writing effects, there's 9 non-Haskellers writing that 'Haskell's big mistake was being pure and not allowing effects - you should use X instead'.
Other advantages of pure FP might be thread safety but queues take care of most of this (and often locks are not hard to use). Or low-level compositionality. But as Alan Kay said, what we need are bigger objects. John Ousterhout seems to agree. Re-use in the small increases complexity.
You've selected for the work that you already do.
If you wanted to use transactions, you'd find them impossible, give up and go back to not having transactions.
And once you give up on the impossible dream of transactions, you're back to no problems in practice.
I assume that all of this gets funding because ten years later it makes C# programmers more productive, not because of mass appeal.