On 8/20/21 6:14 PM, Joseph Brenner wrote:
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?
Hi Joseph, Probably not what yo are asking, but i will give it a shot. If you go to https://docs.raku.org/ and look up your variable, scroll down and look for "type graph", it will tell you what your variable is a member of. If both your variables are inthe graph, then you will probably (watch the weasel word) get away with it. For instance: https://docs.raku.org/type/Real#Type_Graph Me personally, I run "raku" (or perl6) and it start an interactive session of raku. Then I fool around with variables (and other things) to find out what works and what does not. When I give up, I ask the guys here. :-) -T P.S. If you use variables a lot, learn Raku's rendition of OOP (object orientated programming). Once you get the hang of it, a whole new world opens up for you. Raku's OOP is awesome! Any any one that acts like Raku's OOP is h-a-r-d if pulling your strings. I stink at programming and I learned it, despite some of the insults I got thrown at me (not from this quarter, thank goodness) Post anew or write me off line and I will send you my write up on OOP
