Description
A kebab name in the current spec is made up of one or more "fragments" separated by a hyphen (-
). These fragments can't begin with a number.
However, there are examples in WebIDL that will need to be translated to WIT where either a name part or the whole name starts with a number.
GPUExtent3D
->gpu-extent-3d
GPUSize32
->gpu-size-32
GPUTextureDimension
cases "1d", "2d", and "3d" ->1d
,2d
,3d
The main concern to my knowledge with letting fragments/identifiers start with numbers is that these are translated into programming language identifiers which typically don't allow identifiers to start with numbers. However, many languages have techniques available in their grammar to handle these cases when translating names (e.g. mapping 1d
to _1d
in Rust).
WIT authors on the other hand have relatively few options for handling these. They could either manually use domain/convention knowledge (e.g. 1d
as d1
), which isn't possible using automated tools like in-progress WebIDL -> WIT efforts, or add arbitrary prefixes to the front of their interface (e.g. c1d
for case 1d
).
I think that making bindings generators find language-specific ways to handle making identifiers valid will be better than forcing WIT authors to write names that don't begin with numbers, so we should consider letting all fragments in names start with numbers.