I'm hoping to give a talk on Clojure Envy, perhaps at a local meeting.
These are some topics I hope to cover.
My name is Rich Morin.
I've been programming for about 45 years.
I've done substantial projects in Assembler, C, Fortran, Perl, and Ruby.
I've also been paid for writing code in C++, COBOL, and a few other languages.
Most of my programming experience, even when I was using object-oriented languages,
has been procedural in nature and driven by data structures and transformations.
So, there is a lot about functional programming that I find natural and reasonable.
That said, it took me several years to find a functional programming language
that felt comfortable.
I have books on a number of FP languages, including Clojure, Haskell, Scala, and Scheme.
It wasn't until I found Elixir, however, that I felt at home.
Much of what appeals to me about Elixir can be explained by its provenance and motivations.
That is, where did it come from and what were the contributors trying to accomplish.
Erlang was developed at Ericsson as a way to program telephone switches.
So, it had to support highly concurrent, distributed, fail-soft, and scalable applications.
The authors borrowed heavily from Prolog, with a nod to Lisp.
Although they did not realize it at the time,
they were implementing a version of the Actor model
So, for example, Erlang relies heavily on lightweight processes and message passing.
Erlang also provides a routing network of message switches,
which may have been inspired by its application domain.
Finally, it has strong support for pattern matching and fail-soft process management.
Rich Hickey created Clojure as a language and programming environment
for concurrent (but not
He borrowed heavily from Lisp, with nods to Java, the JVM, etc.
Clojure's reference types allow safe, efficient concurrency
within a single (operating system) process.
José Valim created Elixir as a way to do scalable web programming.
He adopted Erlang's infrastructure and design philosophy wholesale,
borrowed heavily from Clojure, and stole some concrete syntax from Ruby.
He also took documentation and tooling ideas from Python and Rails,
pipelines from F#, etc.
In summary, Elixir is an eclectic, pragmatic functional programming language.
Erlang's design is primarily motivated by reliability and scalability;
processing efficiency is a secondary concern.
Actors, concurrency, distribution, messages, and pattern matching
are (loosely speaking) implementation details.
Clojure optimizes strongly for concurrency within a single process:
distributed processing, for example, is explicitly rejected as a goal.
Process management and overall system reliability
are mostly left as problems for the application developer.
Elixir is motivated by convenience, distribution, reliability, and scalability.
To support these, it incorporates a number of design choices from its ancestor languages.
These include dynamic typing, greedy evaluation, message passing, pattern matching,
syntactic macros, and more.
Clojure and Elixir share a large number of approaches and capabilities.
However, they can (and do!) claim bragging rights in certain areas:
- Elixir has an extremely solid story on fail-soft distributed processing,
based on decades of development and use by the Erlang community.
- Clojure's managed references support efficient, safe management of
identity, state, and value among processes on a single CPU node.
Elixir already has many of Clojure's key features, including:
lists, macros, persistent data structures, and protocols.
Elixir's tooling and documentation are already on a par with Clojure's,
though there are still a few features we should consider stealing.
It looks pretty trivial to add more of Clojure's persistent data structures (e.g., Vectors).
Implementation of reference data types may be possible,
as discussed in my Puffy Data
This would give Elixir a way to share state across process boundaries
in a safe, coherent fashion.
I also expect to see many Clojure-inspired extensions and variations.
ElixirScript, for example, could draw on ClojureScript, Elm, Om, and other recent work.
Typed Elixir could take advantage of work done in Clojure, Racket, and other languages.
The development community is very innovative, so there is a lot of technology to choose from...
This wiki page is maintained by Rich Morin
an independent consultant specializing in software design, development, and documentation.
Please feel free to email
comments, inquiries, suggestions, etc!