elixir-lang/elixir-lang.github.com — pull request #6 by alco (2012-03-23 10:30:01+00:00)
Title: Chapter 4 fixes

The following bits are unclear to me.

>Dispatching a protocol is available to any data type as long as it implements the prototype.

I read it like so: "Dispatching a function of a protocol to an object of any data type is possible as long as the data type implements the protocol". Is this correct? Then one thing that remains unclear is whether it is required to implement all functions defined in a protocol.

After taking a second look at the examples, it occurred to me that a protocol _is_ a single function in Elixir. Is that so? Coming from Objective-C background, I'm used to think of protocols as collections of methods, much like interfaces in Java.

---

In section "4.2.2 Using protocols with records" we implement the `blank?` function on our tree. Does this function need to be defined inside the `RedBlack` module? In other words, is it possible to take an existing module and make it conform to a protocol by implementing protocol functions elsewhere, without changing the module's code?

---

>Finally, since records are simply tuples, the default implementation for records can be given in the tuple implementation.

The meaning of this one I do not understand.