Inspired by a reddit discussion, I decided to create short blog post to ask two questions:
- Is static typing winning?
- 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.
Some of the most popular dynamic languages are considering some form of static typing:
- Ruby: Matz announced that Ruby 3.0 may have type annotations.
- Python: Guido van Rossum sent out a proposal to add type annotations to Python.
- 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.
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.
Similarly, some of the most popular imperative languages are adding features from functional programming:
- Java: version 8 added lambdas, functional interfaces (i.e. functions, almost), method references (i.e. first class functions, almost), and the stream API.
- C++: version 11 and version 14 added support for functional programming features.
- C#: there is a book and several guides on functional programming in C#.
- Swift: Apple’s new language for iOS and OS X has many functional programming features.
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:
- Haskell: Facebook, Bump, Google, Microsoft, NY Times.
- Clojure: Amazon, Netflix, Groupon, Heroku, and Twitter.
- Erlang: WhatsApp, Facebook, Amazon, Riak, CouchDB, Yahoo.
- 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?