Protocol library as alternative to refinements (Russell Leggett)
Benjamin (Inglor) Gruenbaum
inglor at gmail.com
Tue Oct 22 09:19:30 PDT 2013
Dean Landolt <dean at deanlandolt.com> wrote:
> Say you have an object for which you want to implement the Cowboy and
Canvas protocols (to borrow /be's favorite example). Both implement a
"draw" method, but when you try to import from both protocols you'll
naturally have to rename one or both. Now say you want to override Cowboy's
`draw` method on an instance? You'll end up clobbering the Canvas
protocol's draw method with the obviously wrong function. Not cool. This
can be easily corrected with Symbols.
I'm not sure I understand the example. What does a Cowboy's draw method do?
Is it a specification of the Canvas protocol draw ? (In that case
`.extend`ing the protocol seems to solve it). If you have a more concrete
use case that would really help.
I don't see how this is any different from other variables and general
naming conflict issues when destructuring.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss