A bit of background history
When I started programming, the big thing was object-oriented programming. If you were doing anything else than that, you were either unlucky, forced to maintain some old COBOL stuff, or stupid, not seeing the “great greatness” of OOP. On my end, I had a thing for assembly languages, learning as many as I could, even VHDL. In those days, I justified myself by saying that low-level languages were more suitable for embedded programming.
Not so long after that, web programming became the big trend. Rapidly, the necessity of having a powerful and effective developping tool was outed by just having the right idea, at the right time and be the first to put it on the Internet. Being good at marketing seemed more important than writing beautiful code; fast and dirty code more useful than complex and large scale architecture. Meanwhile, I finished school, started working on games, the “blockbuster” type, using C++, and never really went into web programming.
I never was a complete rebel, but mainstream never was my thing. My mom and I have the habit of spoting the ugliest thing in a clothing store and making fun of it. I feel proud when I do something because I love it, and not because it is fashionable. But I wouldn’t refuse myself something trendy just for the sake of it, if I truly like it. I had mixed feelings when I realized the proportion of stuff I like in store suddenly increased recently. I was even more surprised when I saw the same pattern emerge in computer science.
When I first heard about functional programming languages, I was amused at the large amount of parenthesis, and didn’t gave much attention. During our wedding vacation, we had a long conversation about programming languages’ grammars. Alex explained to me the simplicity of the LISP grammar, and how it affected the mindset of the programmer using it. He told me that there had to be a way to make functional programming language possible in C³ in order to make it truly complete. On the other end, he didn’t want to let go on all the other programming styles he loved so much, imperative, generic, etc.
Soon after that, I started seeing functional programming everywhere. It had been there for more than fifty years, I just opened my eyes. People arguing about how Haskell was the best language ever, D introducing functional programming, Scala… well… existing! Many other people seemed to have seen the “divine” light at the same time I did.
Evolution vs. Revolution
So what is different with this, compared to the previous trend? I feel that previously, things would be fashionable because they were new and shiny. Functional programming is different, it is attractive because it actually solve problems that we currently care about – optimization, parallelization etc. This is evolution, instead of revolution.
In order to make it a true evolution, we cannot simply reuse the old things from the past. There are fundamental problems that kept LISP from being more popular in the past. If functional programming languages are perfect for certain types of problem, they are totally horrible in other situations. The obvious idea would be to mix it with the other programming styles, to make functional more convenient, or to add the possibilities of functional to an already good but incomplete system. But the problem is that functional programming style doesn’t play well with others, the very basics of the paradigm rely on purity, on the assumption that “side effects” are not possible. But someone found a trick.
When my husband started reading about LLVM, he stumble upon “SSA is Functional Programming” (which was part of my Christmas reading list last year). The trick is to have an intermediate form, the Static Single Assignment form, for the imperative code. If the grammar allows the imperative form to be compiled into a functionnal form, then the two can coexist and you can get the best of both worlds: easier writing and understanding of the code, and effective optimization and parallelization. I’m oversimplifying things, but it gives an idea of the mindset!