On 7-Dec-09, at 4:05 PM, Meikel Brandmeyer wrote: > Hi, > > Am 07.12.2009 um 21:37 schrieb Bob Hutchison: > >>> 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? > > Dispatch on the class (or interface) is sometimes the "trick" in > clojure. That means a special case, which solves the problem. Eg. > the print-method which causes things to be printed by print > dispatches on type. Now, type recognises any type tag on the > metadata of a thing. But when there is no method defined for this > type, print would barf. So the default print-method simply dissocs > the type tag from the metadata and retries causing basically a > dispatch on the class of the underlying container. Most likely some > Map or so. So dispatching on the class is here the trick. > Dispatching on type the usual case.
Thanks. BTW, I'm thinking that my use of the word 'trick' might have been a mistake. Where I come from 'does the trick', 'that's the trick' and so on mean something along the line of 'that's how you get the required result', and that's what I hoped to say... I didn't mean to imply any kind of trickiness existed that would fool me into write 'class' rather than 'type'... ignorance explains that quite nicely :-) 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 [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
