Proposal: Extend `ruby-rbs` crate features

Aperta
#2,954 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
ruby, rust
Ambito
devtools

Direzione di ricerca

Inizia esaminando il crate ruby-rbs esistente e i corrispondenti livelli superiori nel gem rbs. La proposta riguarda TypeName/Namespace, EnvironmentLoader, Environment e DefinitionBuilder, quindi determina prima quale livello e quale ambito il progetto accetterà. Il lavoro sarebbe completato solo con un’interfaccia Rust e un piano di implementazione concordati, non con una singola modifica isolata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Motivation

The ruby-rbs crate currently provides only the parser layer (AST + Visit trait).
The rbs gem, in contrast, ships several higher-level layers on top of the parser — environment construction, name resolution, and definition (ancestor / method) resolution.

Until those layers exist on the Rust side, downstream tooling (type checkers, LSP servers, code generators) cannot be built using ruby-rbs alone. This issue proposes to gradually port those upper layers into the crate.

Features I want

I'm building a static type checker in Rust for my own gem.
Currently, RBS type definitions are loaded on the Ruby side and the result is then handed over to Rust for analysis.
I'd like to move the loading step into Rust as well, so the whole pipeline can be driven through a Rust interface — which requires the following layers in ruby-rbs:

  • TypeName / Namespace — structured type names like ::Foo::Bar; prerequisite for every layer below
  • EnvironmentLoader — discovering .rbs files from gem paths / libdirs, equivalent to rbs gem's loader
  • Environment — merging declarations from multiple files (class reopens, module aliases) and exposing a lookup API
  • DefinitionBuilder — resolving inherited methods via MRO so callers can ask "what methods does Foo::Bar expose?" without re-implementing ancestor traversal in every consumer

Of course, things won’t always go as planned.

Willingness to contribute

If the RBS core team is planning to expand ruby-rbs with these upper layers, I'd love to contribute actively — not just file this as a wishlist.

Lingua principale
Ruby
Stelle
2.2k
Fork
263
Merge medio
1g 20h
PR unite (30g)
64

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby/rbs

Tutte le issue di ruby/rbs

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.