Elixir features inspired or modelled after other languages

I’m going to present an Elixir talk next week and I’m trying to gather a list of Elixir features that were inspired or modeled after other language features. Right now I’ve got the following list:

  • Syntax (Ruby)
  • Docstrings (Python)
  • Polymorphism and Protocols (Clojure)
  • Mix build tool (Clojure’s Leiningen and Ruby’s Rake)
  • Lazy evaluation (Haskell) -> I’m not 100% certain on this one?
  • Pipeline operator (Clojure, but F# also has a similar one I believe)

I was thinking if ExUnit (aka built-in Unit Testing) also was inspired by any language? Probably by Ruby too, I guess.

Does anyone know of any other features that were inspired by other languages? :slight_smile:

1 Like

I think this is a great topic for a talk! :023:

Two notable omissions are Erlang (would be great to see where it has been most influential) and maybe mention pattern matching specifically as well?

1 Like

Hey @AstonJ, I’m omitting Erlang since Elixir is built for the Erlang VM and it basically inherits all of Erlang’s features :blush:

Erlang also has Pattern Matching, although I’m not completely sure if Elixir expands it further than Erlang? From my limited Erlang experience I’d say they’re the same.

1 Like

I personally wouldn’t list lazy evaluation as an elixir feature. Yes, with the Stream module you can achieve it, but it is done by the module, not core to the language.

If I recall, the pipeline operator comes most directly from F# which gets it from OCaml.

I think ExUnit comes most directly from Ruby, but really all the *Unit testing libraries go back to Smalltalk.

Macros were inspired by lisp in general, but you could name clojure specifically.

You could point out that hex is inspired by several dependency tools. I know ruby gems are one, but there are probably more.

If it were me giving the talk, I would want to mention erlang for the core concurrency model, though I understand your other comment that there’s so much elixir gets from erlang. You could point out that the pattern matching in both erlang and elixir comes from prolog.

3 Likes

Also worth adding that I kept most of Erlang’s syntax for data structures purposedly, so Erlang plays a big role on the syntax side of things too.

Yup, docstrings and doctests come from Python.

And the @derive feature in protocols is inspired by a similar feature in Haskell’s type classes.

I wouldn’t say Rake had a big influence on Mix. My experience with Bundler played a bigger role on Mix for sure.

If by lazy evaulation you mean streams, then citing Haskell is correct although I wouldn’t call it lazy evaluation. :slight_smile: There was a lot of Haskell research involved for implementing streams in a purely functional fashion. The original idea came from Jessica Kerr’s talk on scalaz though. More info here: http://blog.plataformatec.com.br/2015/05/introducing-reducees/

Not Clojure. It was from one of the ML variants (SML I think?) and F#.

6 Likes

Thank you so much for you reply @josevalim it’s good to have you correct and confirm my info before the talk :slight_smile:

About the macros and metaprogramming aspect of Elixir. It was inspired by Clojure, right? Or did you look at older Lisps directly?

1 Like

I remember looking at multiple Lisps. At least Common Lisp and Scheme to take an informed decision regarding hygiene and gensym. I cannot recall any special aspect from Clojure on this regard. Elixir ended-up having contextual hygiene (where variables belong to the modules that define them) which I don’t think I have seen elsewhere.

5 Likes