Inspired by a reddit discussion, I decided to create short blog post to ask two questions:

  1. Is static typing winning?
  2. Is functional programming winning?

In other words, are we at a turning point where most modern languages are moving towards static typing and functional programming? Let’s consider the evidence.

Static typing

Some of the most popular dynamic languages are considering some form of static typing:

  1. Ruby: Matz announced that Ruby 3.0 may have type annotations.
  2. Python: Guido van Rossum sent out a proposal to add type annotations to Python.
  3. PHP: Facebook has released Hack, which supports type annotations on top of the PHP syntax. Moreover, PHP itself already has Type Hinting and may add return type declarations.
  4. JavaScript: Facebook has released Flow, Microsoft has released TypeScript, Google has released Dart and AtScript, and there are many statically typed languages that compile to JavaScript, including GWT (Java to JavaScript), Scala.js (Scala to JavaScript), Haste (Haskell to JavaScript), and purescript (Haskell-ish to JavaScript).

Of course, most of these type systems are not as strict as, say, Haskell, but whether you call it static typing, gradual typing, type hinting, type inference, or type annotations, the goal everywhere seems to be the same: try to catch more errors at compile time instead of run time.

Functional programming

Similarly, some of the most popular imperative languages are adding features from functional programming:

  1. Java: version 8 added lambdas, functional interfaces (i.e. functions, almost), method references (i.e. first class functions, almost), and the stream API.
  2. C++: version 11 and version 14 added support for functional programming features.
  3. C#: there is a book and several guides on functional programming in C#.
  4. Swift: Apple’s new language for iOS and OS X has many functional programming features.
  5. JavaScript: I’m seeing more and more functional JavaScript these days thanks to things like underscore.js, promises (ie, monads), react.js, bacon.js, and compile-to-JS languages like ClojureScript.

Of course, tossing in a few functional features does not a functional programming language make, but still, the trend is encouraging. Moreover, languages that are functional at their core seem to be growing in popularity too:

  1. Haskell: Facebook, Bump, Google, Microsoft, NY Times.
  2. Clojure: Amazon, Netflix, Groupon, Heroku, and Twitter.
  3. Erlang: WhatsApp, Facebook, Amazon, Riak, CouchDB, Yahoo.
  4. Scala: LinkedIn, Twitter, Box, Foursquare, Coursera, Nest, Quora, Tumblr, VMWare.

What’s the future?

There is some research that shows that static typing and functional programming are modestly better than dynamic typing and imperative programming, respectively (albeit it’s far from air tight). That said, I’ve been hearing this sort of hype for a long time, and only in the last year or two do I feel like it’s finally starting to make a noticeable dent in the industry.

Are you noticing the same trends? Do you like seeing more static typing and functional programming? Will we all be Haskell programmers soon?

Leave your thoughts as a comment or discuss this post on reddit and Hacker News.