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

Make package (role) initialization depend on metamodel HOW class #2565

Open
vrurg opened this issue Dec 24, 2018 · 0 comments
Open

Make package (role) initialization depend on metamodel HOW class #2565

vrurg opened this issue Dec 24, 2018 · 0 comments
Labels

Comments

@vrurg
Copy link
Member

vrurg commented Dec 24, 2018

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 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
@vrurg 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 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
@vrurg vrurg added the roles label Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant