Adz
1 min readJul 10, 2018

--

You are correct that it is a slightly contrived example, and that it is a somewhat unusual use of some of the Elixir language features, but the example was chosen to make it simple to explore the problem.

Let me pose the problem again:

Imagine that you need to be able to add new shapes to your code AND new functions on those shapes (like circumference). You need to be able do this without touching any old code, so that you can expose your code in a library and keep it extensible to others.

How would you go about achieving this with or without protocols? You will not manage it with map, reduce and filter. I’d be interested to hear how you would approach it!

--

--

Responses (1)