From c9486122fe5974a535523b58051c37aaa3cf6d081aacc1f0340f2cde02245f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Bj=C3=B6rnstam?= Date: Tue, 20 Oct 2026 18:07:47 +0200 Subject: [PATCH 1/2] within takes a Duration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-opus-5-5) Co-Authored-By: eca-agent --- index.sz | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.sz b/index.sz index 4e5ec43..6a9a13d 100644 --- a/index.sz +++ b/index.sz @@ -39,14 +39,14 @@ build it. ConcurrentML brings the multithreading story for bjolang into the 1990s. It uses events that can be combined and synced on, meaning you can build trees of events and then preform them. This is indeed an extra layer for most operations in cml compared to CSP-inspired things, but allows us to write composable events. The function @code{within} returns a new event can be composed with other events. You can of course perform @code{within} in golang by writing a special function that races two fibers, but the composable version is not writeable. @codeblock[#:lang "bjolang"]{ -(: within (-> int (Event %a) (Event (Option %a)))) -(defun (within ms ev) +(: within (-> Duration (Event %a) (Event (Option %a)))) +(defun (within d ev) (choose (wrap ev #(Some &)) - (wrap (timeout ms) (fun (u) None)))) + (wrap (timeout d) (fun (u) None)))) -(sync (within 20 (chan-recv kitchen))) ;; => None, and nothing is consumed -(sync (within 500 (chan-recv kitchen))) ;; => (Some "dinner") -(sync (within 20 (spawn-evt (count-to 1000)))) ;; works on fibers too +(sync (within (milliseconds 20) (chan-recv kitchen))) ;; => None, and nothing is consumed +(sync (within (milliseconds 500) (chan-recv kitchen))) ;; => (Some "dinner") +(sync (within (milliseconds 20) (spawn-evt (count-to 1000)))) ;; works on fibers too } This sums every line and every char read from stdin. When the port is closed, the result is printed using the show function from (std fmt). From 4952b06c2cec453fa3c09de152a53f784073e2a408eefb2fd795b8bc422e308e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Bj=C3=B6rnstam?= Date: Tue, 20 Oct 2026 18:07:54 +0200 Subject: [PATCH 2/2] manual: timers take a Duration, formatting text, benchmarks, std/url and native executables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-opus-5-5) Co-Authored-By: eca-agent --- manual | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual b/manual index 82adbb0..cefa231 160000 --- a/manual +++ b/manual @@ -1 +1 @@ -Subproject commit 82adbb03a4912010d55935170159a2c172e392fefb512939d5f3c3c19c8935ec +Subproject commit cefa2313add8eeac492ae7e60a215583394f494c25ac3b1e1df312a3d34581f4