On 12 Dec 2009, at 01:14, Jason Wolfe wrote:

> A very simple example is: I have a protocol "A", and sub-protocols
> "A1" and "A2".  Every A is either an A1 or A2, but not both (and this
> split is closed, as far as I'm concerned).  Sometimes I want to deal
> with instances of A1 and A2 together, and so I put the methods shared
> between all "As" in protocol "A".  But, at some point I need to
> separate out the "A1"s from the "A2"s.  To do this, it seems like I
> have at least three options:

Those are the options you have in the world of protocols, types/ 
classes, and hierarchies. But there are many more options for  
classifying objects. For example, you could have a set A1 to which you  
add all the types in your A1 category. Or you could call functions  
specific to A1 or A2 through a lookup table implemented as a map. I  
can't judge if any of these would work fine for you, of course.

Konrad.

-- 
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