From 55ecdf24bb8e199b299bbf40070c7f90db5994ab Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 8 May 2026 22:55:20 +0000 Subject: [PATCH] =?UTF-8?q?plans:=20Phase=207=20verified=20=E2=80=94=20427?= =?UTF-8?q?/427=20(idiom=20110)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- plans/tcl-sx-completion.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plans/tcl-sx-completion.md b/plans/tcl-sx-completion.md index 32d936f2..67999ebe 100644 --- a/plans/tcl-sx-completion.md +++ b/plans/tcl-sx-completion.md @@ -327,6 +327,24 @@ coro 20, idiom 82). --- +## Phase 7 — Real-script polish ✓ + +What was left to make a moderately complex Tcl script run unchanged. + +| Status | Work | Notes | +|---|---|---| +| [x] | **Phase 7a — `try`/`catch`/`finally`** | Extended existing `tcl-cmd-try` with `trap pattern varlist body` clause matching errorcode prefix. Handler varlist supports `{result optsdict}` to capture both result and `-options` dict. Existing `on code var body` clauses unchanged. | +| [x] | **Phase 7b — `exec` pipelines + redirection** | New `exec-pipeline` SX primitive parses `|`, `< file`, `> file`, `>> file`, `2> file`, `2>@1` and builds a process pipeline via `Unix.pipe` + `Unix.create_process`. `tcl-cmd-exec` dispatches to it when any metachar is present. | +| [x] | **Phase 7c — `string` subcommand audit** | Added `string equal ?-nocase? ?-length n? s1 s2`, `string totitle`, `string reverse`, `string replace s f l ?new?`. Added `string is true/false/xdigit/ascii` classes (already had integer/double/alpha/alnum/digit/space/upper/lower/boolean). | +| [x] | **Phase 7d — TclOO (`oo::class`)** | Minimal `oo::class create NAME body` with `method`, `constructor`, `destructor`, `superclass` declarations. Instances via `Cls new ?args?`. Method dispatch via per-object Tcl command. Single inheritance via `:super` chain. Class/object state on interp `:classes`/`:oo-objects`/`:oo-counter`. Mixins/filters/`oo::define` deferred. | +| [x] | **Phase 7e — `regexp` audit** | Existing `Re.Pcre` wrapper handles `^`/`$` anchors, `\b` boundaries, `-nocase`, capture groups, `regsub -all`. Added regression tests covering each. No code changes needed. | + +**+28 idiom tests** (5 try, 5 exec pipeline, 7 string, 6 regexp, 5 TclOO). +**Total: 427/427 green** (parse 67, eval 169, error 39, namespace 22, +coro 20, idiom 110). + +--- + ## Suggested order 1. **Phase 1** — immediate Tcl wins, zero risk, proves the approach @@ -343,6 +361,7 @@ becomes a lasting SX contribution used by every future hosted language. _Newest first._ +- 2026-05-08: Phase 7 verified — 427/427 (idiom 110). try/trap with errorcode prefix matching + 2-var optsdict capture; exec pipelines with `|`/`<`/`>`/`>>`/`2>@1` via Unix.pipe + create_process; string equal/totitle/reverse/replace + is true/false/xdigit/ascii classes; regexp regression suite; minimal TclOO (oo::class create / new / single inheritance / ctor / methods); +28 idiom tests. - 2026-05-08: Phase 6 verified — 399/399 (parse 67, eval 169, error 39, namespace 22, coro 20, idiom 82). Fixed vwait `::var` infinite loop via tcl-var-lookup-or-nil helper; info exists also uses it now. - 2026-05-07: Phase 6e exec — exec-process SX primitive (Unix.create_process+waitpid, captures stdout, errors on non-zero exit with stderr) + Tcl `exec cmd arg...`; +3 idiom tests - 2026-05-07: Phase 6d scan/format — printf-spec + scan-spec SX primitives wrapping OCaml Printf/Scanf via Scanf.format_from_string; Tcl format rewritten to dispatch via printf-spec; scan is real walker; supports d/i/u/x/X/o/c/s/f/e/E/g/G/% with width/precision/flags; +7 idiom tests @@ -373,3 +392,4 @@ _Newest first._ - Tk / GUI - Threads (mapped to coroutines only, as planned) - Server-mode `vwait` — Phase 5b event loop is scoped to script-mode; from inside a server-handled command it can't see sx_server's stdin scheduler +- TclOO mixins, filters, `oo::define` after-the-fact, multiple inheritance — Phase 7d covers single-inheritance class declarations only