#1144: MMD incorrectly matches _ instead of String
-----------------------------+----------------------------------------------
 Reporter:  Austin_Hastings  |        Type:  bug   
   Status:  new              |    Priority:  normal
Milestone:                   |   Component:  none  
  Version:  1.7.0            |    Severity:  medium
 Keywords:                   |        Lang:        
    Patch:                   |    Platform:        
-----------------------------+----------------------------------------------

Comment(by Austin_Hastings):

 After bouncing off this problem again, and doing some further
 investigation, I've learned that:

 `mmd_distance` (src/multidispatch.c ~ line 770-790) explicitly checks if
 the args to the call are "int,float,string" and the callsig wants
 "Int,Float,String", and assigns that promotion a distance of 1.

 `mmd_distance` then, _immediately_, checks if the args to the call are
 "any basic type" and the callsig wants "PMC" (aka '_'), in which case the
 distance is 1.

 On the one hand, this is two ways of saying that "boxing has a distance of
 1". But on the other hand it means that when you pass a 'string'
 (lowercase) to a (String) or to a (_) multisig, they both have a distance
 1.

 What I was trying to achieve with (_) was "if you haven't matched anything
 closer, use this error case". To this end, I think that while
 constant->PMC should not be "big distance", it should probably be greater
 than just 1.

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/1144#comment:1>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to