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

Can't talk about roles with unimplemented methods in Rakudo #3010

Closed
p6rt opened this issue Dec 28, 2012 · 7 comments
Closed

Can't talk about roles with unimplemented methods in Rakudo #3010

p6rt opened this issue Dec 28, 2012 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 28, 2012

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

Searchable as RT116220$

@p6rt
Copy link
Author

p6rt commented Dec 28, 2012

From @masak

<doy> r​: role Foo { method bar {...} }; say Foo.perl
<p6eval> rakudo c8de2e​: OUTPUT«Method 'bar' must be implemented by Foo
because it is required by a role [...]
<doy> ^^ bug?
<doy> r​: role Foo { method bar {...} }
<p6eval> rakudo c8de2e​: OUTPUT«Method 'bar' must be implemented by Foo
because it is required by a role [...]
<doy> hmmm
<masak> that doesn't feel like it should error out.
<masak> r​: role Foo { method bar {...} }; say 42
<p6eval> rakudo c8de2e​: OUTPUT«42␤»
<masak> oh, it has something to do with role Foo being used as a
return value or something.
<doy> yeah
<masak> and evaluating it causes it to auto-pun itself into an
anonymous class, maybe?
<masak> if so, then that's the part that feels wrong.
<masak> it must be possible to talk about a role with unimplemented
methods without it throwing an error.
* masak submits rakudobug
<masak> n​: role Foo { method bar {...} }; say Foo.perl
<p6eval> niecza v24-12-g8e50362​: OUTPUT«Unhandled exception​: Method
'bar' must be implemented by 'Foo' because it is required by role
'Foo[curried][...]' [...]
<masak> n​: role Foo { method bar {...} }
<p6eval> niecza v24-12-g8e50362​: ( no output )
<masak> Niecza half agrees.
<masak> unless the spec absolutely *mandates* that a role should
auto-pun to a class when .perl'd, I think it's a bad idea.
<doy> all of the stringification methods have the same issue, which is
why i ran into this

@p6rt
Copy link
Author

p6rt commented Dec 28, 2012

From @masak

<doy> also​: its not just stringification methods, it seems that calling
any method at all on a role with required methods is broken
<doy> r​: role Foo { method bar {...} }; say Foo.^name
<p6eval> rakudo c8de2e​: OUTPUT«Method 'bar' must be implemented by Foo
because it is required by a role [...]
<masak> :/
<masak> r​: role Foo { method bar {} }; say Foo.^name
<p6eval> rakudo c8de2e​: OUTPUT«Foo␤»
* masak adds that to the ticket

@p6rt
Copy link
Author

p6rt commented Dec 28, 2012

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

@p6rt
Copy link
Author

p6rt commented Feb 9, 2015

From @usev6

The above error happens no longer with all methods. Maybe now really just stringification methods are affected?

$ perl6 -e 'role Foo { method bar {...} }; say Foo.^name'
Foo

$ perl6 -e 'role Foo { method bar {...} }; say Foo.^methods'
bar

$ perl6-m -e 'role Foo { method bar {...} }; say Foo.perl'
Method 'bar' must be implemented by Foo because it is required by a role
  in any compose_method_table at src/gen/m-Metamodel.nqp​:2493
  in any apply at src/gen/m-Metamodel.nqp​:2503
  in any compose at src/gen/m-Metamodel.nqp​:2650
  in any make_pun at src/gen/m-Metamodel.nqp​:1531
  in any find_method at src/gen/m-Metamodel.nqp​:1554
  in block <unit> at -e​:1

$ perl6-m -e 'role Foo { method bar {...} }; say Foo.WHAT'
Method 'bar' must be implemented by Foo because it is required by a role
  in any compose_method_table at src/gen/m-Metamodel.nqp​:2493
  in any apply at src/gen/m-Metamodel.nqp​:2503
  in any compose at src/gen/m-Metamodel.nqp​:2650
  in any make_pun at src/gen/m-Metamodel.nqp​:1531
  in any find_method at src/gen/m-Metamodel.nqp​:1554
  in sub say at src/gen/m-CORE.setting​:17365
  in block <unit> at -e​:1

1 similar comment
@p6rt
Copy link
Author

p6rt commented Feb 9, 2015

From @usev6

The above error happens no longer with all methods. Maybe now really just stringification methods are affected?

$ perl6 -e 'role Foo { method bar {...} }; say Foo.^name'
Foo

$ perl6 -e 'role Foo { method bar {...} }; say Foo.^methods'
bar

$ perl6-m -e 'role Foo { method bar {...} }; say Foo.perl'
Method 'bar' must be implemented by Foo because it is required by a role
  in any compose_method_table at src/gen/m-Metamodel.nqp​:2493
  in any apply at src/gen/m-Metamodel.nqp​:2503
  in any compose at src/gen/m-Metamodel.nqp​:2650
  in any make_pun at src/gen/m-Metamodel.nqp​:1531
  in any find_method at src/gen/m-Metamodel.nqp​:1554
  in block <unit> at -e​:1

$ perl6-m -e 'role Foo { method bar {...} }; say Foo.WHAT'
Method 'bar' must be implemented by Foo because it is required by a role
  in any compose_method_table at src/gen/m-Metamodel.nqp​:2493
  in any apply at src/gen/m-Metamodel.nqp​:2503
  in any compose at src/gen/m-Metamodel.nqp​:2650
  in any make_pun at src/gen/m-Metamodel.nqp​:1531
  in any find_method at src/gen/m-Metamodel.nqp​:1554
  in sub say at src/gen/m-CORE.setting​:17365
  in block <unit> at -e​:1

@p6rt
Copy link
Author

p6rt commented Apr 7, 2016

From @diakopter

14​:04 <diakopter> m​: role Foo { method bar {...} }; say Foo.perl
14​:04 <camelia> rakudo-moar 61d231​: OUTPUT«Foo␤»
14​:04 <diakopter> m​: role Foo { method bar {...} }; say Foo.WHAT
14​:04 <camelia> rakudo-moar 61d231​: OUTPUT«(Foo)␤»

@p6rt
Copy link
Author

p6rt commented Apr 7, 2016

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

@p6rt p6rt closed this as completed Apr 7, 2016
@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