IO registry: defio declares platform suspension points
Core SX has zero IO — platforms extend __io-registry via (defio name :category :data/:code/:effect ...). The server web platform declares 44 operations in web/io.sx. batchable_helpers now derived from registry (:batchable true) instead of hardcoded list. Startup validation warns if bound IO ops lack registry entries. Browser gets empty registry, ready for step 5 (IO suspension). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -671,6 +671,27 @@ let () =
|
||||
|
||||
bind "define-page-helper" (fun _ -> Nil);
|
||||
|
||||
(* IO registry — starts empty in browser. Platforms extend via defio.
|
||||
Browser has zero suspension points initially; future browser IO
|
||||
(lazy module loads, fetch-request) will add entries here. *)
|
||||
let io_registry = Hashtbl.create 16 in
|
||||
ignore (env_bind global_env "__io-registry" (Dict io_registry));
|
||||
ignore (Sx_ref.register_special_form (String "defio") (NativeFn ("defio", fun sf_args ->
|
||||
let raw_args = match sf_args with
|
||||
| [List a; Env _] | [ListRef { contents = a }; Env _] -> a
|
||||
| _ -> [] in
|
||||
match raw_args with
|
||||
| String name :: rest ->
|
||||
let entry = Hashtbl.create 8 in
|
||||
let rec parse = function
|
||||
| Keyword k :: v :: rest -> Hashtbl.replace entry k v; parse rest
|
||||
| _ -> () in
|
||||
parse rest;
|
||||
Hashtbl.replace entry "name" (String name);
|
||||
Hashtbl.replace io_registry name (Dict entry);
|
||||
Dict entry
|
||||
| _ -> Nil)));
|
||||
|
||||
(* --- Render --- *)
|
||||
Sx_render.setup_render_env global_env;
|
||||
bind "set-render-active!" (fun _ -> Nil);
|
||||
|
||||
Reference in New Issue
Block a user