Skip to content

Deno source-to-source host→guest callback ABI (blocks withProgress/registerCommand/onDidSave) #199

Description

@hyperpolymath

Problem

The Deno/Node source-to-source backend (lib/codegen_deno.ml) has no host→guest callback mechanism. It explicitly has "no handle table" (codegen_deno.ml:9) and ExprHandle lowering ignores handlers. The only working callback path in the estate is the wasm adapter packages/affine-vscode/mod.js, which resolves a handler Int via inst.exports.__indirect_function_table (wrapHandler).

Consequently, on the Deno source-to-source target, any extern that takes an AffineScript thunk the host must invoke is unimplementable:

These currently only function on the wasm backend.

Why separate from #103

#103 (async-extern ABI) split into:

The callback ABI is a distinct, larger, one-way-door design (it dictates how every host→guest callback is shaped on the source-to-source backend, not just async), so it is tracked here rather than expanding #103.

Design space (not yet decided)

  • Guest exports a thunk-dispatch entrypoint; codegen_deno emits a JS-side handle registry the adapter calls back into.
  • Alternatively: closures-as-values lowering so handlers are real JS functions passed directly (no Int handle indirection on the source-to-source path at all).

Acceptance

  • registerCommand, onDidSaveTextDocument, withProgress all functional on --deno-esm / --vscode-extension output.
  • rsr-certifier vscode pilot fully restored (the withProgress-wrapped checks).

Refs #103

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions