Re: Multiple matching dispatch values (multimethods)

2012-09-14 Thread Sean Corfield
My first thought on seeing: (collide some-gaussjammer some-starship) was "He's colliding two starships, he'll want (defmethod collide [::starship ::starship] ...)" In (what's left of) my OO brain, I think "That only requires one upcast on gaussjammer to starship in order to get an exact matc

Multiple matching dispatch values (multimethods)

2012-09-14 Thread Brian Marick
Here's a simplification of an exercise I was trying to write. We have a two-level hierarchy of objects: (derive ::starship ::thing) (derive ::gaussjammer ::starship) We have a generic function that uses both arguments: (defmulti collide (fn [one two] [(type one) (type two)])) We ha