Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why isn't it more popular?

I think Richard Feldman [0] proposed some of the most reasonable theories as to why functional programming isn't the norm. Your language needs to be the platform-exclusive language for a widely used platform, have a killer application for a highly desired application domain, or be backed by a monster war-chest of marketing money to sway opinions.

Since Feldman's talk, Python has grown much faster in popularity in the sense of wide use in the market place... but mostly because it's the scripting language of choice for PyTorch and AI-adjacent libraries/tooling/frameworks which is... a killer application.

I like OCaml. I started evaluating functional programming in it by taking the INRIA course online. I spent the last four and half years working in Haskell. I've built some side projects in Zig. I was a CL stan for many years. I asked this question a lot. We often say, "use the best tool for the job." Often that means, "use the tool that's available."

I think languages like OCaml, Rust, Haskell etc can be "popular," but in the sense that people like to talk about them and want to learn them and be able to use them (at least, as trends come and go). It's different from "popular" as in, "widely adopted."

[0] https://www.youtube.com/watch?v=QyJZzq0v7Z4



> mostly because it's the scripting language of choice for PyTorch and AI-adjacent libraries/tooling/frameworks

I would politely disagree. Torch started in Lua, and switched to Python because of its already soaring popularity. Whatever drove Python's growth predates modern AI frameworks


Python was already big for scientists back in 2010. I remember working on Python tooling at the time, and DS/ML was one of our single largest user groups. It was already popular enough to have an IDE specifically for scientific Python use: https://en.wikipedia.org/wiki/Spyder_(software).

As far as I could tell, it had to do with two things. First, Python is notoriously dynamic and extensible, making it possible to implement "sloppy" syntax like advanced slicing or dataframes. But also, those guys had lots of pre-existing C and Fortran code, and Python had one of the easiest extensibility APIs to wrap it as high-level packages. And with IPython, you had a nice REPL with graphing to use all that from, and then of course notebooks happened.


Yeah, I can see that. At the time of the talk Feldman claims Python is a slow-and-steady language. It definitely did get a lot of support from the scientific/engineering community for a long time. I spent a good part of my career with Python from about 2006-2016.

It had boosts from Django... but it never had Rails' level of popularity. You kinda have to be first-to-market and that good to get the "killer app" effect.

It's also been integrated as the scripting language for several popular software pacakges (Blender comes to mind).

Machine learning and now... "AI"; seems to be a market cornered by Python quite a bit.


Google blessed Python at a time when Java didn’t even have lambdas.


A MAJOR portion of popularity was because of this xkcd comic.

https://xkcd.com/353/

It hit the front page of Slashdot, Digg, Reddit, made the rounds on Hacker news, etc... (https://news.ycombinator.com/item?id=86246)

Django was also very popular at the time.

I had already learned Basic, C++, Java, and C#. I wanted to add a dynamic scripting language that was cross-platform under my belt.

A lot of my peers were in the same boat.

Python seemed at the time, to be the only general purpose scripting language that was easy to use on multiple platforms.

I had heard bad things about Perl being write only, and Ruby being tough to deploy, I also found it hard to read. (Which is a shame they are wonderful languages, though Ruby is dog slow, Python is slow too, but Ruby is worse somehow).

IIRC Google and some other large companies were pushing it as one of their official languages.

Right as Python was rocketing in popularity, Go came out, and I also heard a lot of good things about Clojure (they seemed neck and neck in popularity from my incorrect perspective at the time, lol).


I think Python became popular before Go came out.

Do you mean the comic was responsible, or the comic explains why Python is popular? It is definitely the ecosystem. As you said its general purpose. It is used for numerical computing and visualisation, web apps, GUIs, sysadmin. Even a reasonably popular DVCS is written in Python.


I wrote: “Right as Python was rocketing in popularity, Go came out.”

I wasn’t talking chronology of first release, just describing the overlap in hype cycles back then.

The comic was released in 2007, and started heading to the moon. Go came out around 2009, and almost instantly got traction.


I do not mean to disagree with just, just wanted to clarify some wording and add to the "general purpose aspect of Python.


I look at how people write TypeScript these days, and think about how the world might have been different if, 10-15 years ago, these functional languages had been a bit closer to the imperative world. OCaml allows mutation and side effects and could even feel a bit imperative if it weren't for the "let ... in" syntax.

Let's face it, syntax matters. We saw that with Elixir becoming much more popular than Erlang ever did. We saw it with TypeScript being able to introduce a fairly complex type system into JavaScript, and becoming successful among web devs by adapting to established ecosystem and offering a gradual approach, rather than forcing an entirely new, incompatible paradigm on it. The TypeScript story seems a little improbable in hindsight, but it was able to get there by offering an incremental path and making a lot of compromises (such as config options to allow less strict enforcement) along the way.

Personally, I think a new syntax for OCaml might actually be successful if done right. Sure, there have been multiple attempts (the "revised" syntax, Reason, etc.), but none of them are really willing to modernize in ways that would attract your average programmer. The toolchain also needs work to appeal to non-OCaml programmers.


Could you explain how Reason syntax isn't "really willing to modernize in ways that would attract your average programmer"? I'm trying to understand what do you even mean.


Reason still looks like an ML-style language rather than something from the C family of things (where JavaScript ultimately comes from).

For example, in Reason, a function is:

    let x: (int, int) => int = (a, b) => a + b;
A more JS-like syntax might be:

    fn x(a, b int): int {
      a + b
    }
Or at least:

    let x = fn(a, b int): int {
      a + b
    }


But the Reason example you shared is almost valid TypeScript already!

https://www.typescriptlang.org/play/?#code/DYUwLgBAHgXBAUBDO...

I've seen JS using lambdas instead of classic functions like that in the wild. And that Reason can be made more JS-idiomatic without changes to the syntax:

    let x = (a: int, b: int): int => a + b;


[flagged]


TCL it's almost Lisp with strings instead of atom lists. I prefer it a little over Perl.


No macros, limited support for higher order functions. Its big drawback is the small ecosystem.

I like TCL, but its not really comparable to lisp. Its definitely a great scripting language and is a lot more flexible than it gets credit for.

It got a lot of things right. Event driven concurrency (and its got a good threading model) which is often given as a reason to use JS to right servers. Sandboxing untrusted code. Easy GUIs with Tk. Easy cross platform deployment. Unfortunately it never got traction.


> Unfortunately it never got traction.

Categorically not true. Tcl got a LOT of traction. Expect was everywhere. Tk kicked ass and took names. AOLserver, anyone? VLSI CAD stuff still uses it today.

It just got pushed out of the way over time. IMO, mostly because VB6 took its niche of easy GUI.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: