Since timtimo++ saw this ticket and tried to ping me on IRC I'm going to
explain why I wanted this to work. See:

https://github.com/LLFourn/p6-AttrX-InitArg/
And in particular this commit.
https://github.com/LLFourn/p6-AttrX-InitArg/commit/ffd5e962020d85595b2c2edd08f3900999944899

I was using Attribute.package to figure out the class that I should apply
the "InitArgContainer" role to. I found that this didn't work with roles
because $attr.package was a GenericHOW. So instead I used a compiler hack
($*PACKAGE), which worked perfectly.

If MOP introspection doesn't work, compiler introspection will. I think it
would be better if the former had the power so I could avoid the latter.

 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
introspection related to auto-documentation. If I want to produce
documentation for a class, I want to know where it's attributes and methods
came from, ie which file, which module, in which package.

I'm totally fine if this is NOTABUG for now, I didn't know there was this
theme of roles are not real packages. I knew of course they weren't real
classes ( which is why It was supprising when I found I could .new them!)

LL

On Tue, Jan 12, 2016 at 12:46 AM Lloyd Fournier <
perl6-bugs-follo...@perl.org> wrote:

> # New Ticket Created by  Lloyd Fournier
> # Please include the string:  [perl #127236]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=127236 >
>
>
> role Foo { has $.foo; }; Foo.^attributes[0].package.^name.say #->$?CLASS
>

Reply via email to