Dear all,
After playing a bit with protocols I found this (which seems odd to me):
(All of this on clojure-1.2.0-master-SNAPSHOT, downloaded with lein - i
don't know how recent it is)
user> (defprotocol Foo (foo [x] )) ; We define a protocol Foo
user> (def bar {:foo Foo}) ; We hide it in a record
#'user/bar
user> (= (:foo bar) Foo) ; It's still equal to itselffrom
true
user> (extend Object (:foo bar) {:foo (fn [x] :bar)}) ; We extend it
nil
user> (foo 5) ; It works
:bar
user> (= (:foo bar) Foo) ; it's not equal to itself anymore
false
By the way, if you look at the extenders of each:
user> (extenders (:foo bar))
nil
user> (extenders Foo)
(java.lang.Object)
Foo is extended but not its copy.
Is it what it is supposed to do?
Best regards,
Nicolas.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en