Skip to content

Name collision risk with flat module compilation #110

@aallan

Description

@aallan

When multiple imported modules define functions with the same name, the flat compilation strategy (C7e) may produce name collisions in the WASM output. Currently, local definitions shadow imports and last-registered wins for import conflicts, but this is not guaranteed to produce correct results in all cases.

Example:

  • Module A defines helper()
  • Module B defines helper()
  • Main program imports both A and B

The flat namespace means both get compiled into the same WASM module, and the second registration silently overwrites the first.

Possible fix: Prefix-mangle imported function names (e.g., vera_math$abs) to guarantee uniqueness. This would require updating call rewriting in wasm.py to use mangled names for imported functions.

Scope: This is a known limitation of v0.0.38 (C7e). Low risk in practice since most modules define distinct APIs. A fix could be part of C7f (formal module semantics) or a standalone enhancement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C8eC8e — Codegen gapsenhancementNew feature or requestmodule-systemCross-file module system

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions