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

Inaccurate assignment to $!shortname in cases where a mixin happens during BUILD time. #5242

Closed
p6rt opened this issue Apr 17, 2016 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Apr 17, 2016

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

Searchable as RT127916$

@p6rt
Copy link
Author

p6rt commented Apr 17, 2016

From @peschwa

Consider the following snippet​:

23​:28 < psch> m​: role Bar​::Foo { }; class A { submethod BUILD { self does Bar​::Foo } }; A.new.WHAT.say
23​:28 <+camelia> rakudo-moar 617bb4​: OUTPUT«(Foo})␤»

Clearly, A is not of type 'Foo}'. As far as I can tell Perl6​::Metamodel​::Naming is involved, although I'm not sure why this only happens with mixins during BUILD. I'd expect .WHAT to report 'A+{Bar​::Foo}' instead.

@p6rt
Copy link
Author

p6rt commented Apr 20, 2016

From @jnthn

On Sun Apr 17 16​:34​:02 2016, peschwa@​gmail.com wrote​:

Consider the following snippet​:

23​:28 < psch> m​: role Bar​::Foo { }; class A { submethod BUILD { self
does Bar​::Foo } }; A.new.WHAT.say
23​:28 <+camelia> rakudo-moar 617bb4​: OUTPUT«(Foo})␤»

Clearly, A is not of type 'Foo}'. As far as I can tell
Perl6​::Metamodel​::Naming is involved, although I'm not sure why this
only happens with mixins during BUILD. I'd expect .WHAT to report
'A+{Bar​::Foo}' instead.

Nothing to do build BUILD. It golfs to​:

role Foo​::Bar { }; say (42 but Foo​::Bar).^shortname

And it'll be because of this overly-naive code​:

https://github.com/rakudo/rakudo/blob/nom/src/Perl6/Metamodel/Naming.nqp#L6

Maybe set_name should take an optional second parameter for the short name, and the mixin code can set it explicitly.

/jnthn

@p6rt
Copy link
Author

p6rt commented Apr 20, 2016

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

@p6rt
Copy link
Author

p6rt commented Apr 24, 2016

From @peschwa

On Wed Apr 20 02​:54​:29 2016, jnthn@​jnthn.net wrote​:

On Sun Apr 17 16​:34​:02 2016, peschwa@​gmail.com wrote​:

Consider the following snippet​:

23​:28 < psch> m​: role Bar​::Foo { }; class A { submethod BUILD { self
does Bar​::Foo } }; A.new.WHAT.say
23​:28 <+camelia> rakudo-moar 617bb4​: OUTPUT«(Foo})␤»

Clearly, A is not of type 'Foo}'. As far as I can tell
Perl6​::Metamodel​::Naming is involved, although I'm not sure why this
only happens with mixins during BUILD. I'd expect .WHAT to report
'A+{Bar​::Foo}' instead.

Nothing to do build BUILD. It golfs to​:

role Foo​::Bar { }; say (42 but Foo​::Bar).^shortname

And it'll be because of this overly-naive code​:

https://github.com/rakudo/rakudo/blob/nom/src/Perl6/Metamodel/Naming.nqp#L6

Maybe set_name should take an optional second parameter for the short
name, and the mixin code can set it explicitly.

/jnthn

Fixed in Rakudo commit 60550d15, test added in roast commit 95a5c18.

@p6rt
Copy link
Author

p6rt commented May 8, 2016

From @usev6

On Sun Apr 24 03​:51​:25 2016, peschwa@​gmail.com wrote​:

Fixed in Rakudo commit 60550d15, test added in roast commit 95a5c18.

Great! I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented May 8, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant