Stream: wit-bindgen

Topic: wit enum numeric chars not supported


view this post on Zulip Daniel Macovei (Mar 31 2023 at 16:56):

Hey all, my current use case requires me to define a wit enum with a value of sha-256. Seems an enum val can't be comprised of numeric chars. Is there an idiomatic way to handle this, and if not is there openness to a PR? I bet y'all have a good reason for not supporting it at the moment.

view this post on Zulip Lann Martin (Mar 31 2023 at 17:04):

I believe it is an intentional constraint. See: https://github.com/WebAssembly/component-model/issues/134

Came up in considering options for representing enums like: enum tls-version { tls1, tls1-1, tls1-2, tls1-3 } where it would be useful to be able to write an explicit underscore separator: enum tls...

view this post on Zulip Lann Martin (Mar 31 2023 at 17:05):

For this particular case, can you name it sha256?

view this post on Zulip Daniel Macovei (Mar 31 2023 at 17:18):

Yeah that can probably meet my needs in this case. Re: that issue, I understand it to propose an additional separator in case you need numeric chars and a separator in your name, but I don't think I glean the benefit of disallowing numeric chars with the - to begin with.

view this post on Zulip Daniel Macovei (Mar 31 2023 at 17:18):

Appreciate the info you shared!


Last updated: Dec 23 2024 at 12:05 UTC