There are some object types that are "compatible" in certain ways, for example:

 o   You can do arithmetic operations on any Numeric types, a Rat
      minus and Int just works (and gives you a Rat).

 o   You can do set operations on any of the QuantHash types
      (and some other things, like Arrays), so you can take
      the set difference of a Mix and a Bag (and you'll get a Mix).

How would you know what types are compatible for a particular operation?

Is there a way to know what the resulting type is going to be?
Is there some sort of rule about using the least-specific
possible type?

Reply via email to