From 3dfc144f0cda7bdb15c2fdb72e528fa02e9d99d8 Mon Sep 17 00:00:00 2001 From: onatozmenn Date: Sun, 9 Aug 2026 19:31:45 +0300 Subject: [PATCH] The one-clause page shows the refusal it claims MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The page's own heading says "A host without `Io.save` refuses the second module, before any of it runs." The snippet under it ran the module with no host at all and read whichever import execution reached first, which for both of these modules is `deed:io.read` — the operation they share, not the clause that is the difference. Measured in deed-lang/deed#964. `Host::link` reads the whole import section and answers before an instruction runs, which is what the heading says, so that is what the page shows now. The other half is on the page too: the same host links the read-only module and hands it back ready to call. A host that refused both would be a host with no filesystem and would say nothing about the clause. The test transcript further down was five tests and named one that no longer exists. It is seven now, and the compiler's repository reads that list back out of `demo/README.md` on every commit, so this page and that one cannot drift apart quietly again. --- one-clause/index.html | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/one-clause/index.html b/one-clause/index.html index 08111e3..1041992 100644 --- a/one-clause/index.html +++ b/one-clause/index.html @@ -158,16 +158,20 @@

// crates/deed-driver/tests/demo.rs -let stopped = call(&module, "process", &[Value::I64(0), Value::I64(0)]) - .expect_err("read_write needs a host to provide save"); +let mut host = Host::new(); +host.offer("deed:io", "read", |_| Ok(Some(Value::I64(0)))); -let Trap::NeedsAHost(what) = stopped else { - panic!("it should say what it wanted, not {stopped}"); -}; +let refused = host + .link(&module_for("read_write.deed")) + .expect_err("a host that cannot save should refuse the module that saves"); + +assert_eq!(refused.name, "save");

- NeedsAHost carries the name of the operation the module - asked for, and it is reached before any instruction of - process executes. + Host::link reads the whole import list and answers + before an instruction runs. The same host links the read-only module + and hands it back ready to call, which is the other half of it: a + host that refused both would be a host with no filesystem, and that + would say nothing about the clause.

None of this is checked by eye

@@ -177,12 +181,14 @@

$ cargo test -p deed-driver --test demo -running 5 tests +running 7 tests test read_only_imports_read_and_nothing_else ... ok -test running_read_only_without_a_host_names_read ... ok test read_write_imports_read_and_save ... ok -test running_read_write_without_save_names_what_it_wanted ... ok -test the_readme_lists_the_imports_the_modules_actually_have ... ok +test a_host_without_save_refuses_read_write_and_names_save ... ok +test the_same_host_links_read_only_without_restriction ... ok +test running_without_a_host_stops_at_the_first_import_either_way ... ok +test the_readme_lists_the_imports_the_modules_actually_have ... ok +test the_readme_lists_the_tests_this_file_declares ... ok

The last one exists because the listing on this page and in