Skip to content

eval: WASI builtins (clock_now_ms, env_*, arg_*, file_*, net_*) type-check but are unbound in the interpreter #852

Backlog

Description

@hyperpolymath

The interpreter does not provide the WASI builtins. Programs that use them type-check, then fail at run time under affinescript eval. The failure is loud.

pub fn main() -> () { println(int_to_string(clock_now_ms(0) * 0)); }

affinescript eval fails with Runtime error: Unbound variable: clock_now_ms. Re-verified on main-based build 161eaaf.

The same applies to the other builtins that lib/resolve.ml / lib/typecheck.ml seed for WASI: clock_now_ms, env_*, arg_*, file_*, net_*.

Since the interpreter is the reference other backends are tested against (#833), either:

  • bind these in lib/interp.ml (clock, env and args map cleanly to OCaml Unix/Sys); or
  • refuse them under eval with a clear "not available in the interpreter" error before running.

Generated by Claude Code

Activity

  1. whatproblem-ai commented on Dec 1, 2026

    @whatproblem-ai

    Problem: WASI builtins seeded in lib/resolve.ml / lib/typecheck.ml (clock_now_ms, env_*, arg_*, file_*, net_*) type-check but are not bound in lib/interp.ml. affinescript eval then fails at run time with Runtime error: Unbound variable: clock_now_ms. Reproduced on 161eaaf.

    Expected: eval either runs these builtins, or rejects them before execution with a clear "not available in the interpreter" error. This matters because the interpreter is the reference backend (#833).

    Missing: which of the two options is preferred, intended eval semantics for file_*/net_*


    Clarity: 91%. Clear enough to work on.

    ⌨️ Commands · 💬 Have feedback? Tell us · 🎯 New here? Add WhatProblem to your repo · 🔒 Privacy

  2. added
    bindings
    bug
    meta:umbrella
    priority:p2
    scope:repo
    status:ready
    on Dec 1, 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

    bindingsbugmeta:umbrellapriority:p2scope:repostatus:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions