Elixir – Why the dot when calling anonymous functions?

In this article, the author explains why Elixir uses a dot when calling anonymous functions. They start by discussing the limitation in the Erlang VM, which doesn’t allow functions to receive a variadic number of arguments. They then explore a fictional language that allows for multiple arities and functions stored in variables, similar to languages like Clojure, Scheme, and Haskell. However, they point out that Elixir operates differently and has two distinct namespaces for variables and functions. This distinction eliminates naming conflicts and provides clarity when reading and writing code. Comparisons are also made to the syntax in Erlang and other languages running on the Erlang VM. Ultimately, the author argues that using a dot in Elixir helps strike a balance between expressiveness and clarity.

https://dashbit.co/blog/why-the-dot

To top