TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
Where do you get the information from that the second is more
specific than the former? Consider

   constant Num $c = 3; # Num here is funny
   my       Num $n = 3;
   my       Int $i = 3;
   my       Any $a = 3;

And now $i is more specific than $n? Would a call to foo with $i
dispatch to the ro case? Is $a more specific than $n? Note that undef
is the only "value" that meets the impossible constraint. So calling
the rw foo with $i might store an undef. Not to mention the autocoercion
of Num to Int upon assignment. Do you expect the dispatch take that into
account as well? Consider


C++ worked on that issue for years in committee. CLOS has decades of hindsight. Proposing ranking rules is a challenge for another day, but those are my source material thus far.

You can always get your multis so tangled up that you don't know which one is being called, no matter what the rules. Perhaps we need more fine control with intent based properties, to say "read-write is more important to distinguish the functionality of the cases" vs "working with fractions is more important".

--John

Reply via email to