Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$obj.*method() doesn't care about multi methods in Rakudo #3203

Closed
p6rt opened this issue Aug 7, 2013 · 4 comments
Closed

$obj.*method() doesn't care about multi methods in Rakudo #3203

p6rt opened this issue Aug 7, 2013 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 7, 2013

Migrated from rt.perl.org#119193 (status was 'resolved')

Searchable as RT119193$

@p6rt
Copy link
Author

p6rt commented Aug 7, 2013

From @masak

<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.

@p6rt
Copy link
Author

p6rt commented Nov 19, 2015

From @jnthn

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

@p6rt
Copy link
Author

p6rt commented Nov 19, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt closed this as completed Nov 19, 2015
@p6rt
Copy link
Author

p6rt commented Nov 19, 2015

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant