On Wed Aug 07 08:51:34 2013, masak wrote:
> <masak> I've never put it down into words, but I'm disappointed at
> where we ended up with things like $obj.*method()
> <masak> it turns out that there are two axes along which there can be
> "several methods": the mro axis and the multi axis.
> <masak> the .* syntax picked the wrong axis, making the syntax much
> less exciting for Perl 6 programmers.
> <pmurias> masak: you would prefer it to be the multi axis?
> <masak> pmurias: I... I don't know. in a way I still haven't organized
> my thoughts about this enough.
> <masak> pmurias: I really should, and the result should probably be a
> blog post.
> <masak> but it needs to be centered around use cases, and I haven't
> sat down and worked those out.
> <masak> r: class A { method foo($x) { say "A" } }; class B is A {
> method foo(Int $x) { say "B" } }; B.new.*foo(42)
> <camelia> rakudo 1d15f4: OUTPUT«B␤A␤»
> <masak> r: class A { multi method foo($x) { say "generalist" }; multi
> method foo(Int $x) { say "specialist" }; multi method foo(42) { say
> "über-specialist" } }; A.new.*foo(42)
> <camelia> rakudo 1d15f4: OUTPUT«über-specialist␤»
> <masak> right. so only works along the mro axis.
> <pmurias> masak: it's specced to work on both axes
> <masak> pmurias: do you have a reference for that?
> <masak> pmurias: also, does that mean that my last eval above is a
> rakudobug?
> <pmurias> S12:924
> * masak submits rakudobug
> <masak> r: class A { multi method x { say "1" }; multi method x { say
> "2" } }; A.new.*x()
> <camelia> rakudo 1d15f4: OUTPUT«Ambiguous call to 'x'; these
> signatures all match:␤:(A : Mu *%_)␤:(A : Mu *%_) [...]
> 
> It seems to me that one of these should say
> "generalist\nspecialist\nüber-specialist\n". And the last one should
> call all of the matching multi candidates, even if they don't order
> well amongst each other.

Final ruling: .?, .+ and .* are only about single dispatch. Discussion:

http://irclog.perlgeek.de/perl6/2015-11-17#i_11554706
http://irclog.perlgeek.de/perl6/2015-11-18#i_11558970

Behavior codified in tests in S12-methods/calling_sets.t.

/jnthn

Reply via email to