develooper Front page | perl.perl6.users | Postings from August 2021

intermixed types and resulting types

Thread Next
Joseph Brenner
August 21, 2021 01:15
intermixed types and resulting types
Message ID:
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?

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About