Hacker News new | past | comments | ask | show | jobs | submit login
Are static typing and functional programming winning? (brikis98.blogspot.com)
5 points by brikis98 on Feb 6, 2015 | hide | past | web | favorite | 4 comments

Define "winning".

Most new languages contain a type system. Is that "winning"? It means that the idea of type checking has achieved "flavor of the month" status, but it doesn't mean much more... yet. If some of those languages go on to take over the world, then yes, the fact that they have type checking means that static typing is winning.

And, define "static typing" and "functional programming". So C++ added some elements of functional programming. Does that make C++ a functional programming language? Or does it just make C++ a multi-paradigm language that can be used to do some amount of functional programming?

I claim that "winning" doesn't mean winning in the number of check boxes that languages tick. It means winning in the way the languages are used. If everyone who is programming in C++ starts programming in the functional style, then yes, functional programming is winning. If they don't, then having C++ support functional programming just means they added another paradigm that few people are using.

Yes, most languages have a type system, but there is a big difference between only checking those types at runtime ("dynamically typed") versus checking them at compile time ("statically typed"). After an years and years of debating back and forth over the trade-offs between dynamic and static, it looks like the most popular dynamically typed languages are all considering adding compile time checks. It may take years for these features to gain widespread usage, but it's hard to see this and not think that static typing camp is winning the debate.

As for functional programming, I mentioned in the post that adding a few functional features does not mean you have a functional programming language. But again, for years there was a debate over whether the imperative and OO styles were better and if the ideas from functional programming were too esoteric for the mainstream. Now, some of the most popular imperative languages are focusing on first-class functions, higher order functions, pure functions, and immutable data. It'll still take years for all of these ideas to gain widespread usage, but again, it's hard to see these changes and not think that functional programming is winning the debate.

If, ten years from now, 1% of C++ code is written in a functional way, does that really mean that functional ideas are winning the debate? Does the C++ committee deciding that functional programming is a valid approach that C++ could do a bit more to support really mean that functional programming is winning the debate? Or does it just mean that FP is viewed as "not totally without merit"?

So, again, my starting question: What is your definition of "winning"?

Most developers are hesitant to accept new programming paradigms, so it takes a very long time to change how people write code (something Brett Victor captured brilliantly in his talk, The Future of Programming [1]). Therefore, I can't really say if "ten years from now" is the right time frame or if it's more like thirty years.

That said, I think it's safe to say that static typing is "winning" if it ends up being used in almost every single one of the top 10 programming languages. By "used", I mean it's used in the vast majority of the core language libraries and by most major companies that depend on the language. Depending on which popularity chart you want to believe (e.g. langpop [2], TIOBE [3], or RedMonk [4]), the top 10 languages are roughly the various flavors of C (C, C++, C#, Objective C), Java, PHP, JavaScript, Python, Ruby, Perl, and Shell. With the exception of Perl (which will not be in the top 10 for much longer) and Shell (which will probably be in use for a long time), all of those are already statically typed or moving towards it.

I think a similar metric could apply to functional programming: if the top 10 languages use functional programming in the vast majority of the core libraries and by most major companies, then it has "won". This will likely take longer than static typing, but if companies keep adopting languages like Scala and Clojure, they may crack the top 10 some day.

Of course, it's worth mentioning that what's really "winning" right now is a hybrid model: a mix of static and dynamic typing and a mix of imperative and functional programming. Perhaps, in the long term, we'll find where each type of approach works best, use them side by side, and they'll both "win".

[1] http://vimeo.com/71278954 [2] http://langpop.com/ [3] http://www.tiobe.com/index.php/content/paperinfo/tpci/index.... [4] http://redmonk.com/sogrady/2015/01/14/language-rankings-1-15...

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