Hello all, I ran into an extend-type issue with the ClojureScript compiler output. If there's a better place to report such things, please point me there.
If I define a protocol method with multiple arities, implementing it using deftype works as expected, however extend-type does not. The former compiles to a single javascript function, which checks argument length to handle arity. The latter produces two identically named functions, the second of which overwrites the first; hence only one arity is available at runtime. Here's a simplified example. Given a protocol: (defprotocol MyProtocol (something [this] [this x])) I would expect the following two code snippets to compile with functional equivalence. (deftype MyType [] MyProtocol (something [this] ... ) (something [this x] ... )) (deftype MyType []) (extend-type MyType MyProtocol (something [this] ... ) (something [this x] ... )) The former compiles 'something' to a single function. The latter compiles as: myns.MyType.prototype.myns$MyProtocol$ = true; myns.MyType.prototype.myns$MyProtocol$something = function(this$) { ... }; myns.MyType.prototype.myns$MyProtocol$something = function(this$, x) { ... }; -- 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