O'Reilly logo

Functional Programming: A PragPub Anthology by Michael Swaine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required