Skip to content

Instantly share code, notes, and snippets.

@tomjack

tomjack/foo.clj Secret

Created June 3, 2010 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjack/3fbd7c6f776820639aa1 to your computer and use it in GitHub Desktop.
Save tomjack/3fbd7c6f776820639aa1 to your computer and use it in GitHub Desktop.
(ns bar)
(defprotocol Bar
(foo [b]))
(extend-protocol Bar
String
(foo [s] "bar!"))
(ns baz)
(defprotocol Baz
(foo [b]))
(extend-protocol Baz
String
(foo [s] "baz!"))
user> (bar/foo "")
"bar!"
user> (baz/foo "")
"baz!"
user> (.foo "")
No matching field found: foo for class java.lang.String
[Thrown class java.lang.IllegalArgumentException]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment