Functional programming gains Web, networking option with Elixir language

Elixir language, now at version 1.0, leverages Erlang VM to produce short, fast, and maintainable code for the Web and infrastructures

Developers have another option for functional programming with the Elixir language, which has just reached the 1.0 release milestone.

Positioned as a dynamic functional language for building scalable and maintainable applications, Elixer leverages the Erlang VM, which has been geared to low-latency, distributed, and fault-tolerant systems while also used in Web development and embedded software, developer Jose Valim said in a blog post.

"Elixir's strengths are the Web, network, and distributed services," said Valim, who runs research and development at Brazillian software consulting firm Plataformatec, in an email. "So I expect -- and already see -- a lot of applications from Web development to infrastructure work as well as distributed services being written in Elixir."

The top influences on Elixir include Ruby, Erlang, Clojure, and Lisps, Valim said. "Elixir syntax is quite similar to Ruby's syntax," he said, "but as soon as you get past the syntax, you see the semantics are actually quite different." Elixir code runs inside lightweight threads of execution, or processes, that are isolated and use messaging to exchange information.

Elixir is composed of compiler, runtime, and standard library; a templating library for dynamic document generation; a unit test library; an interactive shell; a logging utility; and a build tool. While Elixir developers expect the majority of programs to remain compatible over time, they cannot guarantee that future changes will not break any programs. Changes that could break code include security and bug fixes, compiler improvements, and new kernel module functions. Elixir binaries are guaranteed to work within the same branch.

Functional programming, which relies on mathematical functions for computation, has been positioned as beneficial for concurrency, and it's been attracting a lot of attention lately with languages like Scala and Microsoft’s F# emerging. "Functional programming promotes a coding style that helps developers write code that is short, fast, and maintainable," the Elixir Web page said. Even Java has been getting into the mix, with new lambda programming offering functional capabilities in Java 8.

Not everyone is sold on functional programming, though. InfoWorld columnist Andrew Oliver, for example, expressed concerns about the readability of code and suitability for general-purpose programming.

Copyright © 2014 IDG Communications, Inc.