Skip to content

codegen(core-WASM): float_to_string raises UnboundVariable at compile (works in resolve/typecheck/interp/Deno) #643

Done

Description

@hyperpolymath

Summary

A program that applies float_to_string type-checks but fails to compile on the core-WASM backend:

Code generation error: (Codegen.UnboundVariable "Function or variable not found: float_to_string")

It is wired on the resolve/typecheck, interpreter, and Deno-ESM paths, but the core-WASM lib/codegen.ml has no lowering for it — codegen.ml only names float_to_string in its string-returning-builtins list (~line 475); it does not emit code for it.

Repro

module m;
pub fn f(x: Float) -> String { return float_to_string(x); }
  • affinescript check → Type checking passed
  • affinescript compile → UnboundVariable "float_to_string"

Scope to audit

The other entries co-listed at codegen.ml:~475 (to_lowercase, to_uppercase, trim, string_sub, string_from_char_code, show) may share the same "recognised-but-not-lowered" shape on core-WASM and are worth checking in the same pass (int_to_string appears to be lowered). Note real float→string formatting in raw WASM (no libc dtoa) is non-trivial — may warrant a WASI/runtime helper rather than inline codegen.

Context

Surfaced characterising svalinn-gateway gaps after the constructor-link fix (#138 / #602, ac98c81); distinct from it (a missing builtin lowering, not type registration). Confirmed at main b8ba479.

Activity

  1. added
    architecture
    bindings
    enhancement
    migration
    on Aug 27, 2026
  2. added
    priority:p2
    scope:repo
    status:ready
    feeds:valence-shell
    on Sep 30, 2026
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

    architecturebindingsenhancementfeeds:valence-shellmigrationpriority:p2scope:repostatus:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions