On Dec 7, 12:37 pm, Bob Hutchison <hutch-li...@recursive.ca> wrote: > On 7-Dec-09, at 12:17 PM, Laurent PETIT wrote: > > > > > > > 2009/12/6 Bob Hutchison <hutch-li...@recursive.ca> > > >> On 6-Dec-09, at 3:46 PM, Meikel Brandmeyer wrote: > > >>> Hi, > > >>> Am 06.12.2009 um 21:29 schrieb Bob Hutchison: > > >>>> It turns out that dispatching on play.foo.Foo is the only way that > >>>> works. I was hoping ::f/Foo or f/Foo would work too (maybe my alias > >>>> is > >>>> wrong??). Especially since, with aliasing in the user namespace, I > >>>> can > >>>> create a play.foo.Foo using f/Foo > > >>> Does the following work? > > >>> (ns play.foo) > >>> (deftype Foo []) > >>> (defmulti my-print type) > >>> (defmethod my-print ::Foo [x] (println "Got a foo")) > > >>> (in-ns 'user) > >>> ; Note: normally written as (require [play.foo :as f]) > >>> (alias 'f 'play.foo) > >>> (def x (f/Foo)) > >>> (f/my-print x) > > >> Yes! Thanks! The dispatch on type rather than class is the trick. I > >> actually ended up writing a macro, this is *much* better. > > > Please note that in clojure, it's the dispatch on the class that's the > > "trick", not on the type ;-) > > Sorry, I don't understand what you mean. Could you expand on that a bit? > > Thanks, > Bob > > > > > > > > >> Cheers, > >> Bob > > >>> Sincerely > >>> Meikel > > >> ---- > >> Bob Hutchison > >> Recursive Design Inc. > >>http://www.recursive.ca/ > >> weblog:http://www.recursive.ca/hutch > > >> -- > >> 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<clojure%2bunsubscr...@googlegroups.com > > >> For more options, visit this group at > >>http://groups.google.com/group/clojure?hl=en > > > -- > > 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 > > ---- > Bob Hutchison > Recursive Design Inc.http://www.recursive.ca/ > weblog:http://www.recursive.ca/hutch
I think Laurent means that type should be the preferred/standard mechanism, and class reserved for sneaking over to java-land. -- 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