On Feb 6, 12:18 am, David Nolen <dnolen.li...@gmail.com> wrote:
> > (prefer-method frob ::idea ::thing)
>
> (prefer-method [::runtime-tag1 ::idea] [::runtime-tag1 ::thing])
> (prefer-method [::runtime-tag2 ::thing] [::runtime-tag2 ::idea])
>
> Provide a dispatch fn that extracts the runtime tag.
Yuck. Instead of defining a method on ::idea, you now must define a
method on [something-that-has-no-meaning-in-context ::idea] (because
the dispatch function must now return a vector, which means the
defmethods must now be called on vector dispatch values...).
Maybe one new entry in the preferTable per created thing is not too
burdensome with a few million objects. That dispatch value kind of
hurts my eyes, though.
I was kind of sliding in another direction: I could always implement
CLOS-style method computation and sorting. But of course that might
mean not reusing multifn and its dispatch mechanism, and that seems a
shame. Maybe I could bury the defmethod ugliness in syntactic sugar...
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---