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

Presence of an Mu:U: multi method candidate busts autothreading for all the other candidates #2551

Open
p6rt opened this issue Nov 7, 2011 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Nov 7, 2011

Migrated from rt.perl.org#103112 (status was 'open')

Searchable as RT103112$

@p6rt
Copy link
Author

p6rt commented Nov 7, 2011

From @moritz

use MONKEY_TYPING;
augment class Mu {
  method FOO(Mu​:U​:) {
  say 'Mu.FOO';
  }
}

augment class Str {
  method FOO(Str​:D​:) {
  say 'Str.FOO';
  }
}

('a' & 'b').FOO();

Output​:
Parameter '' requires a type object, but an object instance was passed
  in method FOO at dispatch.pl​:3
  in block <anon> at dispatch.pl​:14
  in <anon> at dispatch.pl​:1

I'd argue that since the FOO method in class Mu fails to type-check
against the argument list, the other candidate should be considered for
autothreading.

I believe (though I can't prove it) that this is the real problem behind
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=103106 (regex-matching on
a junction fails)

@p6rt
Copy link
Author

p6rt commented Oct 25, 2015

From @usev6

At least nowadays this seems to happen only when augmenting class Mu. (I modified the original code a little by adding 'multi' keywords, but I think it still shows the same problem.)

$ perl6 -e 'use MONKEY-TYPING; augment class Mu { multi method FOO(Mu​:U​:) { say "Mu.FOO" } }; augment class Str { multi method FOO(Str​:D​:) { say "Str.FOO" } }; ("a" & "b").FOO; Str.FOO'
Cannot call FOO(Str​: ); none of these signatures match​:
  (Mu​:U $​: *%_)
  in block <unit> at -e​:1

$ perl6 -e 'use MONKEY-TYPING; augment class Any { multi method FOO(Mu​:U​:) { say "Mu.FOO" } }; augment class Str { multi method FOO(Str​:D​:) { say "Str.FOO" } }; ("a" & "b").FOO; Str.FOO'
Str.FOO
Str.FOO
Mu.FOO

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 25, 2015

From @usev6

At least nowadays this seems to happen only when augmenting class Mu. (I modified the original code a little by adding 'multi' keywords, but I think it still shows the same problem.)

$ perl6 -e 'use MONKEY-TYPING; augment class Mu { multi method FOO(Mu​:U​:) { say "Mu.FOO" } }; augment class Str { multi method FOO(Str​:D​:) { say "Str.FOO" } }; ("a" & "b").FOO; Str.FOO'
Cannot call FOO(Str​: ); none of these signatures match​:
  (Mu​:U $​: *%_)
  in block <unit> at -e​:1

$ perl6 -e 'use MONKEY-TYPING; augment class Any { multi method FOO(Mu​:U​:) { say "Mu.FOO" } }; augment class Str { multi method FOO(Str​:D​:) { say "Str.FOO" } }; ("a" & "b").FOO; Str.FOO'
Str.FOO
Str.FOO
Mu.FOO

@p6rt
Copy link
Author

p6rt commented Oct 25, 2015

@usev6 - Status changed from 'new' to 'open'

@JJ
Copy link

JJ commented Jul 24, 2020

This is probably not prioritary, but can someone take a look?

@JJ JJ added the Bug label Jul 24, 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

2 participants