Skip to content

[wgsl] Consider allowing _ ident for struct membersΒ #1310

@kainino0x

Description

@kainino0x

It would have the special meaning of "unused" and it wouldn't be valid to use any ._ member from any code. Additionally, it would be valid to have multiple _ that would normally collide.

We could do this in other places as well (function args in particular), but struct members are most important if you have to add struct members in order to insert padding.

Prior art comes from numerous functional-adjacent languages like Rust (which does not actually allow it in structs) and Haskell/OCaml (in matches and functions iirc, probably not in records).

If we don't want to do this now, the safe thing is to disallow identifiers of _ so that we can use the syntax later. Rust does this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions