Paul Stadig <p...@stadig.name> writes: > Recompiling a polyfn definition 50 times will only end up with a > dispatch table of one entry. The multiple entries get added when you > recompile defrecord and defprotocol. When you recompile a defrecord > form 50 times you get 50 different types which is why the dispatch > table grows both for polyfns and for protocols.
Thanks for clarifying. >> Oh, and here's a whishlist item: It should be possible to add a >> docstring to polyfns, and maybe also other metadata (:pre, :post, :tag, >> ...). tools.macro/name-with-attributes makes that pretty easy. > > Good point. I'll look into this. Great. >> And another question: Since defpolyfn expands into a defonce form, >> does that mean that all (defpolyfn foo ...) forms have to be in the >> same namespace? It looks to me that currently defining the same >> polyfn foo in different namespaces bar and baz will create bar/foo >> and baz/foo which have nothing to do with each other (you cannot >> `use` both bar and baz). IMO, that would be an argument for >> splitting polyfns into a single declaration form and many definition >> forms providing implementations for several types (like defmulti and >> defmethod, or defprotocol and extend). > > Haha a good point. I'll look into this issue. Looks like I will have > to split out the definition from the extension. Should be simple > enough. I'm happy to have complemented my questions with at least a bit useful feedback and pointers. :-) At least this latter point is a blocker for trying to replace my protocols with polyfns right now. Bye, Tassilo -- 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