Skip to content

generated vars use common names #105

Closed

Description

@pvetere

In some cases (such as python), the generated bindings make use of local variables such as "i", "len", and "base". If you use these names in your WIT file as arguments, then you get an error. For example, consider the following WIT file:

power-of: func(base: s32, exp: s32) -> s32

Then try to generate bindings like this and notice the output:

% wit-bindgen wasmtime-py --import power.wit
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "name `base` already defined"', crates/gen-wasmtime-py/src/lib.rs:868:34

The generated code should use more obfuscated names to reduce the potential for this kind of naming collision.

Activity

  1. added
    component-model
    on Nov 18, 2022
  2. added a commit that references this issue on Nov 5, 2025
    93261d0
  3. added a commit that references this issue on Nov 5, 2025
    ea51991
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component-model

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions