Disallow `[method]...` naming unless the resource was defined in the same context
Les mainteneurs répondent en général sous 4 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 30/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- wasm
- Domaine
- compilers
Piste de recherche
Start with the two component examples in this issue and the linked wasm-tools issue #2731; then locate the wasmparser validation and tests that accept these patterns. The rule for when methods may be attached is unresolved, so done means defining that rule and updating validation and tests without breaking the existing wit-component pattern unintentionally.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Currently wasmparser accepts this component:
(component
(import "a" (instance $a
(export "r" (type (sub resource)))
))
(alias export $a "r" (type $r))
(import "b" (instance
(export "r" (type $x (eq $r)))
(export "[method]r.f" (func (param "self" (borrow $x))))
))
)
But arguably this is a bad idea. This isn't representable in WIT at all and there aren't any actual users of this AFAIK, so I think it would be best to disallow this. In essence only the resource definition should be able to attach methods, because otherwise you could have different instances define the same method and it'd be ambiguous of what to call.
More problematically, however, wasmparser also accepts this:
(component
(type (component
(import "a" (type $a (sub resource)))
(export "r" (type $x (eq $a)))
(export "[method]r.f" (func (param "self" (borrow $x))))
))
)
and this is how wit-component works for any component which exports a resource in an interface. This means that this pattern is widely used meaning that the rule of "must be on the definition" would break a lot of components today.
Ideally wit-component would generate a component that looks like htis:
(component
(type (component
(import "a" (type $a (sub resource)))
(export "r" (type $x (eq $a)) (type (sub resource))) ;; note the type ascription here
(export "[method]r.f" (func (param "self" (borrow $x))))
))
)
but wasmparser does not yet implement that today (https://github.com/bytecodealliance/wasm-tools/issues/2731)
I'm also a bit stuck on what "must be next to the definition" means. For example a resource could be declared, then exported, and then methods must be on the type introduced by the export. In that sense some aliases work, but some don't. Hence, the issue here!
- Langage dominant
- WebAssembly
- Étoiles
- 1.4k
- Forks
- 134
- Merge moyen
- 3 j 19 h
- PR mergées (30 j)
- 8
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de WebAssembly/component-model
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
WebAssembly/component-model#609 · 2 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 4 jours
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
WebAssembly/component-model#769 · 1 commentaire ·
Les mainteneurs répondent en général sous 4 jours
-
`use` for `implements` interfaceOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 12/100
WebAssembly/component-model#768 · 1 commentaire ·
Les mainteneurs répondent en général sous 4 jours
-
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
WebAssembly/component-model#753 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 4 jours
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
WebAssembly/component-model#752 · 13 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 4 jours
Toutes les issues de WebAssembly/component-model
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
Les mainteneurs répondent en général sous 1 jour
-
DAE2 crashes on call.without.effects with a non ref.func expressionPeut-être pris @stevenfontanella l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
WebAssembly/binaryen#9404 ·
Les mainteneurs répondent en général sous 1 jour
-
area:compiler effort:S impact:med platform:windows type:bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
area:Analysis enhancement
Difficulté 1/5 1-3 heures Accessibilité débutants 69/100
facebookresearch/atlas-lean#5118 ·
Les mainteneurs répondent en général sous 1 jour
-
C-bugfix
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Quantinuum/hugr#3354 ·
Les mainteneurs répondent en général sous 1 jour