user=> (defn foo [_] "foo")
user=> (defprotocol IFoo
(foo [_]))
Warning: protocol #'user/IFoo is overwriting function foo
IFoo
user=> (extend-protocol IFoo nil (foo [_] "IFoo"))
nil
user=> (foo nil)
"IFoo"
user=> (foo 1)
java.lang.IllegalArgumentException: No implementation of method: :foo
of protocol: #'user/IFoo found for class: java.lang.Integer
(NO_SOURCE_FILE:0)
; Side note: Is there any way to access the old global "foo" function
at this point?
user=> (defn foo [_] "foo") ; I'd prefer a warning here
#'user/foo
user=> (foo nil)
"foo"
user=> (foo 1)
"foo"
-- Aaron
--
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