Chapter 17Protocols in Swift vs. Ruby and Elixir
by José Valim
When Apple announced its new language, Swift, I started reading the docs and playing with the language with great curiosity. I was pleasantly surprised with many features in Swift, like the handling of optional values (and types) and the immutability being promoted throughout the language.
The language also feels extensible. For extensibility, I am using the same criteria we use for Elixir, which is the ability to implement language constructs using the language itself.
For example, in many languages, the short-circuiting && operator is defined as a special part of the language. In those languages, you can’t reimplement the operator using the constructs provided by the language. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access