Swivelgames edited issue #9595:
Feature
Provide an interface for deriving a ComponentFunc params original names
Benefit
Presently,
wasmtime
provides a number tools that can be leveraged for something that resembles Reflection, but the details for Function Parameters are lossy. Especially for more complex runtime parameter mapping, it would be great if the names of function parameters were preserved, and an interface provided for retrieving them.Implementation
In order to maintain backwards compatibility, it could likely be something like a
param_names()
method.impl ComponentFunc pub fn param_names(&self) -> impl ExactSizeIterator<Item = String> + '_` Iterates over names of function parameters
Alternatives
There really doesn't seem to be one that's built-in to
wasmtime
. In order to grab the parameter names, I'd likely need to do something far more complex.Based on
wasm-tools
, though, it seems like the name of the params are preserved in the.wasm
, which is intriguing.To my knowledge, ComponentFunc params are the entities that do not have some way of deriving their original names.
alexcrichton commented on issue #9595:
Parameter names don't affect the ABI but they do affect type-checking. Regardless though I think it'd be reasonable to expose this information!
pchickey closed issue #9595:
Feature
Provide an interface for deriving a ComponentFunc params original names
Benefit
Presently,
wasmtime
provides a number tools that can be leveraged for something that resembles Reflection, but the details for Function Parameters are lossy. Especially for more complex runtime parameter mapping, it would be great if the names of function parameters were preserved, and an interface provided for retrieving them.Implementation
In order to maintain backwards compatibility, it could likely be something like a
param_names()
method.impl ComponentFunc pub fn param_names(&self) -> impl ExactSizeIterator<Item = String> + '_` Iterates over names of function parameters
Alternatives
There really doesn't seem to be one that's built-in to
wasmtime
. In order to grab the parameter names, I'd likely need to do something far more complex.Based on
wasm-tools
, though, it seems like the name of the params are preserved in the.wasm
, which is intriguing.To my knowledge, ComponentFunc params are the entities that do not have some way of deriving their original names.
bjorn3 commented on issue #9595:
Parameter names don't affect the ABI but they do affect type-checking.
??? If changing a parameter name causes a component to not type check, then said change is an ABI breaking change, right?
alexcrichton commented on issue #9595:
Er, to clarify a bit, I mean that the canonical ABI doesn't depend on the parameter names. That was my own definition of "ABI" but you're more accurate that "ABI" in this sense should encompass function linking and yes there different names cause issues.
Last updated: Dec 23 2024 at 12:05 UTC