Protocol library as alternative to refinements (Russell Leggett)

Benjamin (Inglor) Gruenbaum inglor at gmail.com
Mon Oct 21 12:17:54 PDT 2013


Russell Leggett <russell.leggett at gmail.com> wrote:
> https://gist.github.com/genericallyloud/7086380

Very interesting.

>  // 4. use the default if available

what's "the default" in #4? The protocol's default? What's the behavior if
no matching method is found?

Also, can anyone explain why this solves the performance problem scoped
object extensions have? It still seems like it would have to check the
environment for protocols and then check the methods on all available
protocols and do type matching to the type of the method.

`Collections.extend(Array)` seems awfully similar to an array extensions,
how does the `::` operator resolve the need for expensive lookup, can you
explain that to me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131021/667c9547/attachment.html>


More information about the es-discuss mailing list