More Than Just Ruby on Erlang
To understand Elixir, you have to start with its foundation: the Erlang Virtual Machine, or BEAM. Created for telecom systems that couldn't afford to fail, Erlang offered legendary stability and concurrency.
Elixir's creator, José Valim, a veteran of the Ruby on Rails world, saw the power of BEAM but wanted a more productive and extensible language to run on it. The common story is that Elixir is just a friendly, Ruby-inspired syntax laid over Erlang's industrial-strength engine. While true, this misses the most interesting part of the story. The real genius wasn't just in making Erlang more approachable; it was in solving a fundamental problem that every programming language faces in a novel way.
The Polymorphism Puzzle
That puzzle is polymorphism—the ability for code to behave differently based on the type of data it receives. For example, how should a 'size' function work? For a text string, it's the number of characters. For a database table, it's the number of rows. For a geometric shape, it's the area. Object-oriented languages like Ruby often solve this with inheritance or by patching new behaviors onto existing classes, which can become messy. Valim, having come from that world, was keenly aware of its downsides and wanted a cleaner solution for Elixir. The language needed a way to be extended, to allow new data types to participate in existing abstractions, without creating a tangled mess.
The Pivot to Protocols
This is where the 'forgotten' decision comes in. Instead of inventing a new system from scratch or copying Ruby's, Valim looked to another language for inspiration: Clojure. The solution was to adopt a mechanism called 'protocols'. A protocol is essentially a contract. It defines a set of functions—like `to_json` or `size`—but doesn't implement them. It simply states, "for any data type that wants to be part of this system, here is the behavior you must provide." Any data type, from a built-in integer to a complex custom struct, can then provide its own specific implementation for that protocol. This decision was a quiet pivot away from the object-oriented patterns common at the time and toward a more explicit, functional approach to polymorphism.
How Protocols Shaped Everything
This choice had a massive ripple effect. By embracing protocols, Elixir became inherently extensible without being chaotic. You don't need to change the original code to teach an old function new tricks; you just implement the protocol for your new data type. This philosophy is why major Elixir libraries like the Phoenix web framework and the Ecto database wrapper feel so modular and powerful. They define protocols, and the rest of the ecosystem plugs into them. It prevents a central piece of code from having to know about every possible data type in the universe, which is a recipe for fragile software. Protocols are the architectural backbone that enables Elixir's clean, composable, and scalable nature—a foundational decision that is easy to forget, but impossible to imagine Elixir without.






