You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Briefly: if a package keyword is declared in EXPORTHOW::DECLARE with a Metamodel::PrametricRoleHOW itself or its descendant class then the role created with this keyword wouldn't be initialized properly.
Actual Behavior
This code:
Special.pm6
my package EXPORTHOW {
package DECLARE {
# In the following line ParametricRoleHOW could be replaced with a descendant class
constant special = Metamodel::ParametricRoleHOW;
}
}
test.p6
use Special;
special Mine { }
class Foo does Mine { }
Results in Could not instantiate role Mine error.
Expected Behavior
Foo ~~ Mine must result in True.
Suggested fix
The inspection of Grammar.nqp and Actions.nqp in src/Perl6 in (45a945b) revealed a couple of lines with the following code:
$*PKGDECL <cmp> 'role'
where <cmp> is either eq or ne. On IRC Jonathan suggested that this could be replaced with checking of archetypes.
Environment
Operating system: macOS 10.14
Compiler version (perl6 -v): This is Rakudo version 2018.12 built on MoarVM version 2018.12
The text was updated successfully, but these errors were encountered:
vrurg
changed the title
Make package (role) initialization dependand on metamodel HOW class
Make package (role) initialization dependend on metamodel HOW class
Aug 27, 2019
vrurg
changed the title
Make package (role) initialization dependend on metamodel HOW class
Make package (role) initialization depend on metamodel HOW class
Aug 27, 2019
The Problem
The issue is mostly described here: https://stackoverflow.com/questions/53907123/exporthowdeclare-and-role-like-declaration
Briefly: if a package keyword is declared in
EXPORTHOW::DECLARE
with aMetamodel::PrametricRoleHOW
itself or its descendant class then the role created with this keyword wouldn't be initialized properly.Actual Behavior
This code:
Special.pm6
test.p6
Results in
Could not instantiate role Mine
error.Expected Behavior
Foo ~~ Mine
must result in True.Suggested fix
The inspection of Grammar.nqp and Actions.nqp in src/Perl6 in (45a945b) revealed a couple of lines with the following code:
where
<cmp>
is eithereq
orne
. On IRC Jonathan suggested that this could be replaced with checking of archetypes.Environment
perl6 -v
): This is Rakudo version 2018.12 built on MoarVM version 2018.12The text was updated successfully, but these errors were encountered: