vx-lang / vx-lang/Vx

Stdlib decoupling · Step 1: method/trait-impl table in the frozen registry

Open
#218 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core-lang enhancement stdlib
Dominant language
Rust
Stars
14
Forks
2
Avg merge
12h 42m
Merged PRs (30d)
61

Description

Part of the stdlib↔compiler decoupling (see docs/discussions/implementation_plans/stdlib_decoupling_protocol.md, §5–§7 step 1). Epic: TBD.

Why. Method resolution (x.exp()impl Math for f32f32$exp) currently walks borrowed AST ImplBlocks in GlobalAstEnv (src/hir/env.rs). Move it into the GID-keyed frozen registry so resolution is a table lookup, not an AST walk.

Scope.

  • Extend ImmutableGlobalRegistry (src/registry.rs):
    • methods: FxHashMap<(TypeId /*receiver*/, Symbol /*method*/), FnSig> (inherent + trait methods).
    • trait_impls: FxHashMap<(TypeId /*trait*/, TypeId /*type*/), ImplId> (trait selection / coherence).
  • Populate both in build_frozen_registry (src/pipeline.rs), minting the method's FnSig.gid with the same mangling as f32$exp (the existing generic/method mangle in env.rs), keyed by (receiver GID, method name).
  • Add resolve_method(recv, method) / resolve_trait_impl(trait, ty) on the registry.

Acceptance. Dual-run parity: for the existing corpus/tests, the registry resolve_method returns the same target the GlobalAstEnv AST walk does (a unit/integration test asserting equality, mirroring the flat-vs-AST differential pattern). No behavior change yet — GlobalAstEnv stays the oracle.

Blocks Step 2 (type checker queries the registry).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read docs/discussions/implementation_plans/stdlib_decoupling_protocol.md §5–§7, then inspect ImmutableGlobalRegistry in src/registry.rs, build_frozen_registry in src/pipeline.rs, and the existing method walk in src/hir/env.rs. Run the existing corpus/tests and mirror the flat-vs-AST differential pattern so registry resolution matches GlobalAstEnv for methods and trait implementations.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.