Stream: wit-bindgen

Topic: numbers not allowed in identifier


view this post on Zulip Cameron M (May 05 2023 at 08:57):

Hi, I'm trying to provide the following hash function to my WASM component:

world default my-app {
  import host: interface {
    blake2b-256: func(bytes: list<u8>) -> list<u8>
  }
}

but I've hit an error saying that 2 is not a valid character in an identifier.

I've found this passage in this file:

Identifiers in WIT documents are required to be valid component identifiers, meaning that they're "kebab cased". This currently is restricted to ascii characters and numbers that are - separated.

This seems to suggest that this is a bug? I'd be happy to open a PR, but I'm not super familiar with the codebase, so having some idea where to look would be helpful.

Of course, I can just open an issue instead. Or if this is actually intended behavior, then perhaps this wording should be changed?

Repository for design and specification of the Component Model - component-model/WIT.md at main · WebAssembly/component-model

view this post on Zulip Lann Martin (May 05 2023 at 12:13):

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...

Last updated: Dec 23 2024 at 13:07 UTC