I may have misunderstood what I've read about protocols, so please set
me straight if the following is wrong -

On Aug 25, 11:08 pm, Stuart Halloway <stuart.hallo...@gmail.com>
wrote:
> I think the current behavior follows the principle of least surprise:
>
> (1) bar is a function, in whatever namespace the protocol Foo is defined in
>
But bar is not a single function. Multiple bars can coexist in some
sense, right? Otherwise there's no polymorphism?

> (2) you redefine bar (perhaps by reloading the file Foo is in)
>
I don't see this as bar being re-defined, rather bar is defined for
fooed, then defined for Object

> (3) you call bar and get the new behavior
>

It seems that the dispatch mechanism for bar is preferring Object's
bar rather than user.fooed's bar. This is not what I expected. So
maybe the right way to think about this is that protocols don't pay
attention to class hierarchy when dispatching: user.fooed is an
Object, and bar was defined for Object after bar was defined for
user.fooed, so Object's bar is selected?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to