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
Attribute.package is wrong for attributes declared inside roles #5037
Comments
From @LLFournrole Foo { has |
From @LLFournSince timtimo++ saw this ticket and tried to ping me on IRC I'm going to https://github.com/LLFourn/p6-AttrX-InitArg/ I was using Attribute.package to figure out the class that I should apply If MOP introspection doesn't work, compiler introspection will. I think it I think Perl 6 is conflating the notion of a 'package' and a 'class': role Foo { has $.a }; class Bar does Foo { }; Bar.^attributes[0].package.say #-> Bar To me that should be Foo. It was declared in Foo. This is important for I'm totally fine if this is NOTABUG for now, I didn't know there was this LL On Tue, Jan 12, 2016 at 12:46 AM Lloyd Fournier <
|
From @LLFournTo add to the confusion: role Foo { method meth { } }; class Bar does Foo { }; so methods behave as I expect but attributes don't. On Tue, Jan 12, 2016 at 2:00 AM Lloyd Fournier <lloyd.fourn@gmail.com>
|
From @jnthnOn Mon Jan 11 05:46:19 2016, lloyd.fourn@gmail.com wrote:
Just to note that this behavior is intentional rather than accidental (or at least, *I* intended it :-)). Roles undergo generic instantiation at the point of being composed into a class, during which the package is substituted for the type of the class itself. This is important for things like accessor generation to work, since after composition the attributes need to be resolved as if they really are in the class. We might want a declaring-package that is non-generic, if there's a strong enough use case. And the method inconsistency may want resolving. |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#127236 (status was 'open')
Searchable as RT127236$
The text was updated successfully, but these errors were encountered: