slovo/.llm/BETA_2_RUNTIME_RESOURCE_FOUNDATION.md
2026-05-22 12:27:24 +02:00

2.5 KiB

Beta.2 Runtime Resource Foundation Scope

This file tracks the first post-1.0.0-beta.1 runtime/resource foundation slice released as 1.0.0-beta.2.

Implemented In This Slice

  • std.fs.open_text_read_result : (string) -> (result i32 i32) opens a text file for read-only resource-handle flow.
  • std.fs.read_open_text_result : (i32) -> (result string i32) reads remaining text from an open read handle.
  • std.fs.close_result : (i32) -> (result i32 i32) closes an open resource handle.
  • std.fs.exists : (string) -> bool, std.fs.is_file : (string) -> bool, and std.fs.is_dir : (string) -> bool expose narrow filesystem status checks.
  • std.fs.remove_file_result : (string) -> (result i32 i32) removes one file, and std.fs.create_dir_result : (string) -> (result i32 i32) creates one directory. Both return ok 0 on success or err 1 on ordinary host failure.
  • lib/std/fs.slo exposes matching explicit source facade helpers: open_text_read_result, read_open_text_result, close_result, read_text_via_handle_result, close_ok, exists, is_file, is_dir, remove_file_result, create_dir_result, remove_file_ok, and create_dir_ok.
  • Glagol lowers the new calls to private runtime symbols and keeps the existing concrete result families.
  • The test runner and hosted C runtime both enforce the same basic policy: invalid, missing, closed, or exhausted ordinary host failures return err 1 instead of panicking.

Resource Policy

  • Resource handles are positive i32 tokens owned by the current process.
  • Handles are opaque Slovo values, not host file descriptors and not stable ABI values.
  • A handle is valid only until std.fs.close_result succeeds.
  • Reading a closed or invalid handle returns err 1.
  • Closing a closed or invalid handle returns err 1.
  • Resource cleanup is explicit in this beta slice; no finalizer, destructor, ownership transfer, or affine typing rule is claimed.

Explicitly Out Of Scope

  • no writable file handles
  • no binary IO
  • no directory handles
  • no directory enumeration or recursive filesystem operations
  • no process handles
  • no sockets or networking
  • no async/event-loop resource model
  • no platform-specific error codes
  • no rich host-error ADT
  • no stable handle ABI/layout guarantee

Release Gate

  • focused resource/host tests must pass
  • focused std.fs source facade tests must pass
  • promotion-gate std facade alignment must pass
  • full release gate passed before tagging 1.0.0-beta.2