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
Should Perl 6 be able to untangle the inclusion of the same role from different sources? #6030
Comments
From @briandfoyI posted this to Stackoverflow without anyone pointing out the error http://stackoverflow.com/q/41791602/2766176 Imagine a series of complex grammars represented as roles, although role Alpha { role Digit { role Either grammar Thingy my $match = Thingy.parse( '1a3' ); This doesn't work because Perl 6 doesn't untangle the relationships to Method 'alpha' must be resolved by class Thingy because it exists But, reading [S14](https://design.perl6.org/S14.html), I see: A role may not inherit from a class, but may be composed of other I read that to mean that the roles are applied as late as possible, so I ran across this when I was trying to implement grammars for various |
From @raiphGolf'd to: role A { method m {} } Method 'm' must be resolved by class C because it exists in multiple roles Note that the same issue leads also to: role A { has $a } Attribute '$!a' conflicts in role composition A number of devs discussed this on #perl6 with the useful part starting https://irclog.perlgeek.de/perl6/2017-01-24#i_13982402 and ending with jnthn's thoughts. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @skidsOn Tue, 24 Jan 2017 17:11:13 -0800, raiph wrote:
I have a fix for this, see: https://gist.github.com/skids/18fa6fb1de776400abd43b6e82e9fcc2 I just have to resist Warnock's Dilemna and pester people just the riht amount Also, RT#124749 can be combined with this. Locally, using the above linked branch: $ perl6 -e 'role A { method m { 42.say } }; role B does A {}; class C does A does B {}; C.new.m()' |
It looks like this problem has been solved in the meantime. The code from original bug report doesn't error out anymore.
The result looks reasonable, because the parsed string starts with a digit. Parsing
The golfed code also works as expected:
For the record a working link for the discussion mentioned above: https://colabti.org/irclogger/irclogger_log/perl6?date=2017-01-24#l795 If I understand correctly this has been fixed by @vrurg: https://blogs.perl.org/users/vadim_belman/2019/12/post.html (search for "diamond consumption"). The OP also linked to this blog post in the Stackoverflow post. If I'm not mistaken the bug reported in this issue is covered by the following test in roast: https://github.com/Raku/roast/blob/35456a1a68/S14-roles/composition.t#L77-L83. So I'm going to close the issue without adding another test. (Please reopen if I'm wrong and we need more tests.) |
Migrated from rt.perl.org#130634 (status was 'open')
Searchable as RT130634$
The text was updated successfully, but these errors were encountered: