Created
August 10, 2016 17:49
-
-
Save noisesmith/2cd2b9c62c3cd4af7c2e657e09764f89 to your computer and use it in GitHub Desktop.
methods of the same name from different protocols work, if the arg counts differ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user=> (ns foo.bar) | |
| nil | |
| foo.bar=> (defprotocol Baz (quux [this])) | |
| Baz | |
| foo.bar=> (ns foo.baz) | |
| nil | |
| foo.baz=> (defprotocol Bar (quux [this])) | |
| Bar | |
| foo.baz=> (in-ns 'user) | |
| #object[clojure.lang.Namespace 0x2847f343 "user"] | |
| user=> (defrecord Conflicted [] foo.bar.Baz (quux [this] :a) foo.baz.Bar (quux [this] :b)) | |
| CompilerException java.lang.ClassFormatError: Duplicate method name&signature in class file user/Conflicted, compiling:(/private/var/folders/_m/9py48m892rq93bgbc91br8mr0000gr/T/form-init823190090352994200.clj:1:1) | |
| user=> (ns foo.baz) | |
| nil | |
| foo.baz=> (defprotocol Bar (quux [this dummy])) | |
| Bar | |
| foo.baz=> (in-ns 'user) | |
| #object[clojure.lang.Namespace 0x2847f343 "user"] | |
| user=> (defrecord Conflicted [] foo.bar.Baz (quux [this] :a) foo.baz.Bar (quux [this _] :b)) | |
| user.Conflicted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment