refactor(print): remove HostOp::Print and legacy formatting (Compat-C)
- Delete HostOp::Print and StdHost::op_print; the print builtin only routes to bundled io.写值 when Program.print_override is set, otherwise returns a structured kernel.unavailable error (ADR-0031). - Keep the 打印/print builtin name for arity/static validation; Value::display remains only for CLI result rendering, not print execution. - Teach the direct-runtime semantic harness to mirror loader stdlib injection and import edges; replace runtime tests that used print with non-print effects. - Update spec/security/status/changelog/README, add ADR-0031 and evidence. Gate: fmt, clippy -D warnings, 419 tests passed.
This commit is contained in:
1 parent
e26971f489
commit
49910ece43
16 files changed
+304
-56
No files matched your search
+9
-8
@@ -257,7 +257,7 @@ host boundary. Names are stable; adding one requires a spec update.
|
||||
|
||||
| Name | Signature | Notes |
|
||||
|---|---|---|
|
||||
| `打印` / `print` | `(x) -> Unit` | writes `Value::display()` + newline to stdout |
|
||||
| `打印` / `print` | `(x) -> Unit` | Compat-C: routed to bundled `io.写值`; no `HostOp` formatting path. Without the bundle, `kernel.unavailable` |
|
||||
| `长度` / `len` | `(x) -> Int` | Text scalar count, List/Map/Table size |
|
||||
| `类型` / `type` | `(x) -> Text` | value type name |
|
||||
| `文本` / `str` | `(x) -> Text` | explicit conversion |
|
||||
@@ -288,13 +288,14 @@ host boundary. Names are stable; adding one requires a spec update.
|
||||
| `foreign.run/call` | see `spec/foreign.md` | P5, capability-gated |
|
||||
| `fs.read/write` | see `spec/security.md` | capability-gated |
|
||||
|
||||
`打印/print` is **Compat-B** (ADR-0030): when the verified bundled stdlib is
|
||||
available and a loaded module calls the builtin, the loader injects
|
||||
`stdlib/io.mq.md` and sets a program-level `print_override`; the runtime calls
|
||||
`io.写值` instead of `HostOp::Print`. The stdlib chain formats every one of the
|
||||
15 value types, encodes UTF-8 into `Memory`, and writes via
|
||||
`resource.write(stdout)`. The legacy builtin remains the fallback when no bundle
|
||||
is available. Compat-C (removing the legacy formatting path) is not done.
|
||||
`打印/print` is **Compat-C** (ADR-0031): the legacy `HostOp::Print` and its
|
||||
`Value::display()` formatting path are removed. When a loaded module calls the
|
||||
builtin, the loader injects `stdlib/io.mq.md` and sets a program-level
|
||||
`print_override`; the runtime calls `io.写值`. The stdlib chain formats every
|
||||
one of the 15 value types, encodes UTF-8 into `Memory`, and writes via
|
||||
`resource.write(stdout)`. If the official bundle is unavailable, the builtin
|
||||
returns a structured `kernel.unavailable` error; there is no silent formatting
|
||||
fallback. The builtin name remains for arity validation and diagnostics.
|
||||
|
||||
The `list.*`, `map.*`, `text.*` and `table.*` entries are observation and
|
||||
construction primitives, not algorithms (ADR-0023). They return new values and
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ set for one run:
|
||||
|
||||
| Field | Default (`pure`/`project`) | Used by |
|
||||
|---|---|---|
|
||||
| `console: bool` | `true` | `op_print` and `resource.open("stdio","stdout",["write"])`; a missing grant is `permission.denied` and output is also bounded by the output budget |
|
||||
| `console: bool` | `true` | `resource.open("stdio","stdout",["write"])` and the stdlib print chain; a missing grant is `permission.denied` and output is also bounded by the output budget |
|
||||
| `math: bool` | `true` | `math.*` host ops |
|
||||
| `fs_read: Vec<String>` | empty | `fs.read` and project `resource.open("file", path, ["read"])` |
|
||||
| `fs_write: Vec<String>` | empty | `fs.write` and project `resource.open("file", path, ["write"])` |
|
||||
|
||||
Reference in new issue
Block a user