bytecodealliance / bytecodealliance/wasmtime
Make Settings more static
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
Right now, methods on the settings builder are all taking strings as inputs, and maybe strings as values. This makes it very dynamic, and allows a range of runtime errors like a setting doesn't exist, or the provided value doesn't have the right type.
Instead, we could generate methods on the settings builder for each setting:
- for bool values, they would take a bool parameter.
- for enum values, they would take a (Rust) enum parameter.
Then, the entire range of errors described by the enum SetError would disappear, and all these errors would become compile-time errors, which I think is safer and less error-prone.
This implies generating more code for these settings. We don't have thousands of them, so it shouldn't be a problem. It would be a breaking API change, too.
Contributor guide
Assessment
This issue has not been assessed yet.