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

[WIP] Enhance interop of generics, roles, and classes, Raku or nqp #773

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Kaiepi
Copy link
Contributor

@Kaiepi Kaiepi commented May 24, 2022

See rakudo/rakudo#4478. Starts with bug fixes to my prior role typecheck list handling. I have not yet done anything about making nqp's metamodel more consistent with Rakudo's.

Kaiepi added 11 commits May 24, 2022 03:12
- No need for nqp::eqaddr directly in the old tests.
- We need to test for specializations and classes' role_typecheck_list
  in addition to parametric roles. Surprise! We have more work to do
  here.
- Updating a role typecheck list should delegate to another role
  typecheck list at one point or another.
- The role typecheck list should become part of the type cache for any
  given MRO-ish type.
- The role typecheck list should carry a containerless `VMArray` of
  roles, as is the case with the MRO which, combined with the type
  object itself, forms the type cache of a supportive kind of type.
- Because a concrete role's instance is optional as `RoleToClassApplier`
  depends on it, such a nullish value should not become part of the
  roles list.
- Due to the simplicity of the various NQP HOWs' typechecks, each can
  carry a definitive type cache.
- Curried roles need typechecking in order for Rakudo to build with each
  of these changes.
This is more or less a direct translation of Rakudo's `roles`
metamethods as applied. Besides new parameters, the key difference is
`NQPClassHOW.roles`' `:$local` parameter, which (thankfully) was
required before. It should be capable of matching Rakudo's `0` default
because of that.
This is a recursive algorithm, echoing problems with coercions back in
the day. There's a better approach to this.

This reverts commit 533acf9.
`Metamodel::C3MRO` now expects a `:concretizations` parameter, but we
lack the `Metamodel::ConcreteRoleHOW` it wants from whatever carries it;
`:roles` is based off this as well.
A backport of Rakudo's. We lack its efface method here since we lack
`^parents(:excl)`.
Backport of Rakudo's changes. Err against recursing by depending on the
MROs of parents instead.
Include the specialization, not a duplicate of the role that was
specialized.
For consistency with every other HOW.
Backport of Rakudo's changes. `NQPConcreteRoleHOW` follows MRO ordering
for consistency with `Metamodel::ConcreteRoleHOW`.
Backport of Rakudo's changes. Nothing's hidden in nqp, so nothing to
`:excl`.
@coke coke changed the base branch from master to main April 19, 2023 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant