Hey Moritz,

Thanks that also makes clear why it works for subs but not methods. So it was 
rakudo that was correct.

So there is no way to run the second method in the normal way?

class  Foo {                                                                    
                                   
    multi method test (:$a!){                                                   
                                   
        say $a;                                                                 
                                   
    }                                                                           
                                   
    multi method test (:$a!,:$b!){                                              
                                   
        say "$a $b";                                                            
                                   
    }                                                                           
                                   
}                                                                               
                                   
                                                                                
                                   
my $foo = Foo.new;                                                              
                                   
$foo.test(:a('Hello'),:b('World')); 

output: 'Hello'
Thanks,

Lard

On 14/04/2013, at 4:09 PM, Moritz Lenz via RT wrote:

> On Sat Apr 13 20:33:41 2013, [email protected] wrote:
>> Hi,
>> 
>> As I ran in IRC,
>> 
>> [13:12] <lard> perl6: class foo { multi method bar(:$baz) { say
>>   ">",$baz,"<"}}; foo.new.bar(:baz<works>);foo.new.bar(:derp('rakudo
>>   runs method even though nothing matches sig'));
>> [13:12] <+p6eval> niecza v24-37-gf9c8fc2: OUTPUT«>works<␤Unhandled
>>   exception: Cannot call bar; none of these signatures match:␤
>>   foo, Any :$baz␤  at /tmp/W2hmEFv_In line 1 (mainline @ 9) ␤  at
>>   /home/p6eval/niecza/lib/CORE.setting line 4299 (ANON @ 3) ␤  at
>>   /home/p6eval/niecza/lib/CORE.setting line 4300…
>> [13:12] <+p6eval> ..rakudo b5bdbe: OUTPUT«>works<␤>(Any)<␤»
>> 
>> Rakudo is incorrectly binding to methods with a named variable, even
>>   if the named variable with witch it was called does not exist.
> 
> This is in fact specified behavior, see 
> http://perlcabal.org/syn/S12.html#Interface_Consistency
> I
> Cheers,
> Moritz

Reply via email to