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.

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
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to