Skip to content

Commit ac12477

Browse files
committed
docs: haversack-wishlist 2d — #OPTION should override CLI flag defaults
Surfaced verifying §5a's flag-reset fix from the Haversack side: with the host shim applying ['-nowrap'] at init (browser pane reflows visually, so column-wrap splits tokens mid-string), a per-script #OPTION COLUMNS 40 directive becomes effectively ignored — it sets print_width=40 correctly, but terminal_no_wrap=1 from the init flag is still in force. The wrap check short-circuits and the script- author's intent loses to the env default. Proposed mental model: #OPTION is per-script intent, -flags are environment defaults; per-script intent should win for the same conceptual setting. Concrete behaviour shift: #OPTION COLUMNS N implicitly clears terminal_no_wrap=0 (since opting into a column count is opting into wrap-at-that-width). Alternative API noted: dedicated #OPTION wrap counterpart. Implicit-via-COLUMNS preferred because it matches the obvious reading of the directive.
1 parent c5363c5 commit ac12477

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

docs/haversack-wishlist.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ A `DICTPUSHDICT` variant that deep-clones a source handle into the target array
5959

6060
Linked from `notehub/docs/TOOLS.md` script-helpers section "Building arrays of records".
6161

62+
### 2d. `#OPTION` directives should override `-flag` defaults set at init (2026-05-22)
63+
64+
Surfaced today while verifying §5a's flag-reset fix: with Haversack's host applying `["-nowrap"]` at init (because the browser pane reflows visually and column-wrap splits tokens mid-string), a per-script `#OPTION COLUMNS 40` directive becomes effectively ignored — it sets `print_width=40` correctly, but `terminal_no_wrap=1` from the init flag is still in force, so the wrap check at `basic.c:4225/4868/4899` short-circuits. The script-author's intent ("I want this script to use 40-col wrap") loses to the env default ("the host said nowrap").
65+
66+
Mental model that would fix this: **`#OPTION` is per-script intent, `-flags` are environment defaults; per-script intent should win for the same conceptual setting.**
67+
68+
Concrete behaviour shifts:
69+
70+
- `#OPTION COLUMNS N` (a user explicitly opting *into* column-bounded output) implicitly sets `terminal_no_wrap = 0` so the directive actually does what its name suggests.
71+
- `#OPTION nowrap` continues to set `terminal_no_wrap = 1` (no change — it already wins because it's explicit).
72+
- Other conceptual pairs follow the same rule (e.g. if a `#OPTION wrap` is added in future, it'd flip terminal_no_wrap=0 explicitly).
73+
74+
Alternative API: a dedicated `#OPTION wrap` counterpart to `#OPTION nowrap` instead of the implicit-via-COLUMNS clear. Cleaner conceptually (explicit > implicit) but adds a directive name. Lean the implicit shape because it matches the "obvious" reading of `#OPTION COLUMNS N` — anyone who writes that wants wrap behaviour.
75+
76+
Either route closes the Haversack ergonomic gap where tool authors who want column-bounded output can't override a host-applied `-nowrap` from within the script.
77+
6278
### 2c. `DICTDUMP$(handle)` / `BUFFERDUMP$(slot)` — diagnostic snapshots (2026-05-22) — parked
6379

6480
When chasing handle-leak / lifetime bugs in tools, having a way to dump the current slot table state (allocated slots, root types, child counts) as JSON would help. Could share output format with `JSON$(handle)` for the value contents, plus a metadata wrapper. Park until first real handle bug surfaces.

0 commit comments

Comments
 (0)