nomen-lang 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/audit_runtime.c +12 -2
  2. package/core/System/Arena.nm +14 -5
  3. package/core/System/Array.nm +1 -1
  4. package/core/System/Atomic.nm +3 -3
  5. package/core/System/BigInt.nm +182 -23
  6. package/core/System/Buffer.nm +392 -33
  7. package/core/System/ClassBuffer.nm +145 -13
  8. package/core/System/Controls/Alert.nm +3 -3
  9. package/core/System/Controls/App.nm +17 -17
  10. package/core/System/Controls/Button.nm +2 -2
  11. package/core/System/Controls/CheckBox.nm +3 -3
  12. package/core/System/Controls/ColorPicker.nm +2 -2
  13. package/core/System/Controls/ComboBox.nm +2 -2
  14. package/core/System/Controls/Container.nm +39 -33
  15. package/core/System/Controls/DatePicker.nm +1 -1
  16. package/core/System/Controls/Form.nm +2 -2
  17. package/core/System/Controls/GroupBox.nm +2 -2
  18. package/core/System/Controls/ImageView.nm +2 -2
  19. package/core/System/Controls/Layout.nm +5 -5
  20. package/core/System/Controls/LevelIndicator.nm +2 -2
  21. package/core/System/Controls/ListView.nm +2 -2
  22. package/core/System/Controls/Menu.nm +2 -2
  23. package/core/System/Controls/NumberInput.nm +3 -3
  24. package/core/System/Controls/OtpInput.nm +2 -2
  25. package/core/System/Controls/OutlineView.nm +2 -2
  26. package/core/System/Controls/Pagination.nm +14 -14
  27. package/core/System/Controls/Popover.nm +2 -2
  28. package/core/System/Controls/Progress.nm +2 -2
  29. package/core/System/Controls/Radio.nm +3 -3
  30. package/core/System/Controls/Scrollable.nm +1 -1
  31. package/core/System/Controls/SearchField.nm +2 -2
  32. package/core/System/Controls/SecureField.nm +2 -2
  33. package/core/System/Controls/Segmented.nm +2 -2
  34. package/core/System/Controls/Select.nm +2 -2
  35. package/core/System/Controls/Separator.nm +2 -2
  36. package/core/System/Controls/Sheet.nm +2 -2
  37. package/core/System/Controls/Slider.nm +2 -2
  38. package/core/System/Controls/Spinner.nm +5 -5
  39. package/core/System/Controls/SplitView.nm +3 -3
  40. package/core/System/Controls/Stepper.nm +2 -2
  41. package/core/System/Controls/Switch.nm +2 -2
  42. package/core/System/Controls/Table.nm +2 -2
  43. package/core/System/Controls/Tabs.nm +2 -2
  44. package/core/System/Controls/Text.nm +2 -2
  45. package/core/System/Controls/TextBox.nm +3 -3
  46. package/core/System/Controls/TextView.nm +2 -2
  47. package/core/System/Controls/Toggle.nm +3 -3
  48. package/core/System/Controls/Toolbar.nm +2 -2
  49. package/core/System/Controls/Window.nm +12 -5
  50. package/core/System/Fiber.nm +16 -3
  51. package/core/System/Graph.nm +2 -2
  52. package/core/System/LinkedList.nm +13 -4
  53. package/core/System/List.nm +76 -17
  54. package/core/System/Map.nm +179 -21
  55. package/core/System/Mutex.nm +4 -4
  56. package/core/System/Random.nm +6 -7
  57. package/core/System/Set.nm +99 -23
  58. package/core/System/StableList.nm +371 -0
  59. package/core/System/Stream/Directory.nm +2 -2
  60. package/core/System/Stream/File.nm +18 -18
  61. package/core/System/Stream/Http.nm +5 -5
  62. package/core/System/Stream/Tcp.nm +5 -5
  63. package/core/System/String.nm +10 -5
  64. package/core/System/StringBuilder.nm +223 -12
  65. package/core/System/Task.nm +56 -64
  66. package/core/System/Test.nm +18 -18
  67. package/core/System/Text/CharIndex.nm +9 -9
  68. package/core/System/Text/Chars.nm +1 -1
  69. package/core/System/Text/Json.nm +72 -58
  70. package/core/System/Text/JsonTree.nm +126 -98
  71. package/core/System/Text/Regex.nm +43 -38
  72. package/core/System/Text/Utf8.nm +5 -5
  73. package/core/System/Thread.nm +26 -3
  74. package/core/System/Tree.nm +19 -3
  75. package/core/System/float.nm +36 -22
  76. package/core/System/int.nm +80 -28
  77. package/core/System/int16.nm +11 -0
  78. package/core/System/int32.nm +11 -0
  79. package/core/System/int64.nm +11 -0
  80. package/core/System/int8.nm +11 -0
  81. package/core/System/uint.nm +11 -0
  82. package/core/System/uint16.nm +11 -0
  83. package/core/System/uint32.nm +11 -0
  84. package/core/System/uint64.nm +11 -0
  85. package/core/System/uint8.nm +11 -0
  86. package/core/docs/System/StringBuilder.md +6 -0
  87. package/core/docs/System/Text/JsonTree.md +3 -2
  88. package/dist/index.mjs +37622 -30603
  89. package/package.json +1 -1
  90. package/src/bench_loop.nm +9 -9
@@ -386,7 +386,7 @@ pub mv struct Scrollable: Control {
386
386
  }
387
387
 
388
388
  // ── Control trait conformance ──
389
- pub func set_frame = (ref self, int x, int y, int width, int height) {
389
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
390
390
  ```
391
391
  #arch: c
392
392
  #platform: macos
@@ -9,7 +9,7 @@
9
9
  * NSSearchField gives the magnifier icon, placeholder, and Cancel button for
10
10
  * free; UISearchTextField is the iOS 13+ equivalent.
11
11
  **/
12
- pub mv struct SearchField : Control {
12
+ pub mv struct SearchField: Control {
13
13
  var uint64 handle = 0
14
14
 
15
15
  pub func #init = (self, Window window) {
@@ -85,7 +85,7 @@ pub mv struct SearchField : Control {
85
85
  ```
86
86
  }
87
87
 
88
- pub func set_frame = (ref self, int x, int y, int width, int height) {
88
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
89
89
  ```
90
90
  #arch: c
91
91
  #platform: macos
@@ -9,7 +9,7 @@
9
9
  * A distinct native class on both platforms (NSSecureTextField is NOT
10
10
  * NSTextField), so it lands as its own control rather than a TextBox mode.
11
11
  **/
12
- pub mv struct SecureField : Control {
12
+ pub mv struct SecureField: Control {
13
13
  var uint64 handle = 0
14
14
 
15
15
  pub func #init = (self, Window window) {
@@ -105,7 +105,7 @@ pub mv struct SecureField : Control {
105
105
  ```
106
106
  }
107
107
 
108
- pub func set_frame = (ref self, int x, int y, int width, int height) {
108
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
109
109
  ```
110
110
  #arch: c
111
111
  #platform: macos
@@ -9,7 +9,7 @@
9
9
  * The segment count is fixed at construction; labels and the selection are
10
10
  * set/poll per frame like every other control.
11
11
  **/
12
- pub mv struct Segmented : Control {
12
+ pub mv struct Segmented: Control {
13
13
  var uint64 handle = 0
14
14
 
15
15
  pub func #init = (self, Window window, int count) {
@@ -104,7 +104,7 @@ pub mv struct Segmented : Control {
104
104
  ```
105
105
  }
106
106
 
107
- pub func set_frame = (ref self, int x, int y, int width, int height) {
107
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
108
108
  ```
109
109
  #arch: c
110
110
  #platform: macos
@@ -10,7 +10,7 @@
10
10
  * polled after each event batch. iOS needs a picker or action sheet and
11
11
  * defers (TODO stubs below; see GUI_PLAN Tier 1 #9).
12
12
  **/
13
- pub mv struct Select : Control {
13
+ pub mv struct Select: Control {
14
14
  var uint64 handle = 0
15
15
 
16
16
  pub func #init = (self, Window window) {
@@ -62,7 +62,7 @@ pub mv struct Select : Control {
62
62
  ```
63
63
  }
64
64
 
65
- pub func set_frame = (ref self, int x, int y, int width, int height) {
65
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
66
66
  ```
67
67
  #arch: c
68
68
  #platform: macos
@@ -10,7 +10,7 @@
10
10
  * the frame's aspect (wide = horizontal, tall = vertical). macOS-only —
11
11
  * iOS has no separator view (TODO stubs; see GUI_PLAN Tier 1 #17).
12
12
  **/
13
- pub mv struct Separator : Control {
13
+ pub mv struct Separator: Control {
14
14
  var uint64 handle = 0
15
15
 
16
16
  pub func #init = (self, Window window) {
@@ -58,7 +58,7 @@ pub mv struct Separator : Control {
58
58
  ```
59
59
  }
60
60
 
61
- pub func set_frame = (ref self, int x, int y, int width, int height) {
61
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
62
62
  ```
63
63
  #arch: c
64
64
  #platform: macos
@@ -15,7 +15,7 @@
15
15
  * defers to UISheetPresentationController (TODO stubs; see GUI_PLAN
16
16
  * Tier 1 #20).
17
17
  **/
18
- pub mv struct Sheet : Control {
18
+ pub mv struct Sheet: Control {
19
19
  var uint64 handle = 0
20
20
  var uint64 host = 0
21
21
 
@@ -274,7 +274,7 @@ pub mv struct Sheet : Control {
274
274
  // ── Control trait conformance ──
275
275
  // A sheet is window-coordinated like Alert: the layout engine never
276
276
  // frames it (its own NSWindow carries the geometry).
277
- pub func set_frame = (ref self, int x, int y, int width, int height) {
277
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
278
278
  // No-op: the sheet's NSWindow carries the geometry.
279
279
  }
280
280
 
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Continuous control: read `value` each frame in the manual event loop.
10
10
  **/
11
- pub mv struct Slider : Control {
11
+ pub mv struct Slider: Control {
12
12
  var uint64 handle = 0
13
13
 
14
14
  pub func #init = (self, Window window, float min, float max) {
@@ -82,7 +82,7 @@ pub mv struct Slider : Control {
82
82
  ```
83
83
  }
84
84
 
85
- pub func set_frame = (ref self, int x, int y, int width, int height) {
85
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
86
86
  ```
87
87
  #arch: c
88
88
  #platform: macos
@@ -11,9 +11,9 @@
11
11
  * tracked at the Nomen level (NSProgressIndicator has no isSpinning getter),
12
12
  * so `is_spinning` reads true exactly between start() and stop().
13
13
  **/
14
- pub mv struct Spinner : Control {
14
+ pub mv struct Spinner: Control {
15
15
  var uint64 handle = 0
16
- var bool spinning = false
16
+ var spinning = false
17
17
 
18
18
  pub func #init = (self, Window window) {
19
19
  ```
@@ -92,7 +92,7 @@ pub mv struct Spinner : Control {
92
92
  ```
93
93
  }
94
94
 
95
- pub func set_frame = (ref self, int x, int y, int width, int height) {
95
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
96
96
  ```
97
97
  #arch: c
98
98
  #platform: macos
@@ -123,7 +123,7 @@ pub mv struct Spinner : Control {
123
123
  ```
124
124
  }
125
125
 
126
- pub func start = (ref self) {
126
+ pub func start = (ref self {}) {
127
127
  ```
128
128
  #arch: c
129
129
  #platform: macos
@@ -154,7 +154,7 @@ pub mv struct Spinner : Control {
154
154
  ```
155
155
  }
156
156
 
157
- pub func stop = (ref self) {
157
+ pub func stop = (ref self {}) {
158
158
  ```
159
159
  #arch: c
160
160
  #platform: macos
@@ -21,7 +21,7 @@
21
21
  * UISplitViewController (a view-controller-level type — see GUI_PLAN
22
22
  * Tier 2; the iOS blocks are TODO stubs).
23
23
  **/
24
- pub mv struct SplitView : Control {
24
+ pub mv struct SplitView: Control {
25
25
  var uint64 handle = 0
26
26
 
27
27
  // File-scope helper: the pane view class (answers `-contentView` with
@@ -334,7 +334,7 @@ pub mv struct SplitView : Control {
334
334
 
335
335
  // Move divider `index`. For a vertical split the position is the left
336
336
  // edge of the pane after the divider, in points from the left.
337
- pub func set_position = (ref self, float position, int divider) {
337
+ pub func set_position = (ref self {}, float position, int divider) {
338
338
  ```
339
339
  #arch: c
340
340
  #platform: macos
@@ -424,7 +424,7 @@ pub mv struct SplitView : Control {
424
424
  }
425
425
 
426
426
  // ── Control trait conformance ──
427
- pub func set_frame = (ref self, int x, int y, int width, int height) {
427
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
428
428
  ```
429
429
  #arch: c
430
430
  #platform: macos
@@ -9,7 +9,7 @@
9
9
  * Pair with a TextBox for the "number input" composition (gpui-kit's
10
10
  * number-input is exactly that pairing).
11
11
  **/
12
- pub mv struct Stepper : Control {
12
+ pub mv struct Stepper: Control {
13
13
  var uint64 handle = 0
14
14
 
15
15
  pub func #init = (self, Window window) {
@@ -87,7 +87,7 @@ pub mv struct Stepper : Control {
87
87
  ```
88
88
  }
89
89
 
90
- pub func set_frame = (ref self, int x, int y, int width, int height) {
90
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
91
91
  ```
92
92
  #arch: c
93
93
  #platform: macos
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Pairs with CheckBox: check = task state, switch = preference.
10
10
  **/
11
- pub mv struct Switch : Control {
11
+ pub mv struct Switch: Control {
12
12
  var uint64 handle = 0
13
13
 
14
14
  pub func #init = (self, Window window) {
@@ -74,7 +74,7 @@ pub mv struct Switch : Control {
74
74
  ```
75
75
  }
76
76
 
77
- pub func set_frame = (ref self, int x, int y, int width, int height) {
77
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
78
78
  ```
79
79
  #arch: c
80
80
  #platform: macos
@@ -19,7 +19,7 @@
19
19
  * `List<T>` lesson). macOS-only (no iOS counterpart for a plain embeddable
20
20
  * grid; see GUI_PLAN Tier 2 — the iOS blocks are TODO stubs).
21
21
  **/
22
- pub mv struct Table : Control {
22
+ pub mv struct Table: Control {
23
23
  var uint64 handle = 0
24
24
  var uint64 table = 0
25
25
 
@@ -744,7 +744,7 @@ pub mv struct Table : Control {
744
744
  }
745
745
 
746
746
  // ── Control trait conformance ──
747
- pub func set_frame = (ref self, int x, int y, int width, int height) {
747
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
748
748
  ```
749
749
  #arch: c
750
750
  #platform: macos
@@ -17,7 +17,7 @@
17
17
  * NSTabView counterpart (UITabBarController is app-level chrome — see
18
18
  * GUI_PLAN Tier 2; defer with TODO stubs).
19
19
  **/
20
- pub mv struct Tabs : Control {
20
+ pub mv struct Tabs: Control {
21
21
  var uint64 handle = 0
22
22
 
23
23
  // File-scope helper: the page view class. It answers `-contentView` with
@@ -415,7 +415,7 @@ pub mv struct Tabs : Control {
415
415
  }
416
416
 
417
417
  // ── Control trait conformance ──
418
- pub func set_frame = (ref self, int x, int y, int width, int height) {
418
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
419
419
  ```
420
420
  #arch: c
421
421
  #platform: macos
@@ -18,7 +18,7 @@ pub mv struct Text: Control {
18
18
  // The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
19
19
  // twin (same public bare-self methods, no destroy) so closures can
20
20
  // capture this control without moving it. See GUI.md, "Handles".
21
- #handle = () {}
21
+ #handle = () { }
22
22
 
23
23
  pub func #init = (self, Window window) {
24
24
  ```
@@ -249,7 +249,7 @@ pub mv struct Text: Control {
249
249
  return s
250
250
  }
251
251
 
252
- pub func set_frame = (ref self, int x, int y, int width, int height) {
252
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
253
253
  ```
254
254
  #arch: c
255
255
  #platform: macos
@@ -6,13 +6,13 @@
6
6
  * `#destroy` releases what the handle names. The constructor's `self` is
7
7
  * the inline instance (the `.` accessor); methods keep the pointer form.
8
8
  **/
9
- pub mv struct TextBox : Control {
9
+ pub mv struct TextBox: Control {
10
10
  var uint64 handle = 0
11
11
 
12
12
  // The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
13
13
  // twin (same public bare-self methods, no destroy) so closures can
14
14
  // capture this control without moving it. See GUI.md, "Handles".
15
- #handle = () {}
15
+ #handle = () { }
16
16
 
17
17
  pub func #init = (self, Window window) {
18
18
  ```
@@ -111,7 +111,7 @@ pub mv struct TextBox : Control {
111
111
  ```
112
112
  }
113
113
 
114
- pub func set_frame = (ref self, int x, int y, int width, int height) {
114
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
115
115
  ```
116
116
  #arch: c
117
117
  #platform: macos
@@ -17,7 +17,7 @@ pub mv struct TextView: Control {
17
17
  // The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
18
18
  // twin (same public bare-self methods, no destroy) so closures can
19
19
  // capture this control without moving it. See GUI.md, "Handles".
20
- #handle = () {}
20
+ #handle = () { }
21
21
 
22
22
  pub func #init = (self, Window window) {
23
23
  ```
@@ -116,7 +116,7 @@ pub mv struct TextView: Control {
116
116
  ```
117
117
  }
118
118
 
119
- pub func set_frame = (ref self, int x, int y, int width, int height) {
119
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
120
120
  ```
121
121
  #arch: c
122
122
  #platform: macos
@@ -10,13 +10,13 @@
10
10
  * selected state. Where `Button` is momentary, `Toggle` stays depressed
11
11
  * until clicked again (toolbar-style).
12
12
  **/
13
- pub mv struct Toggle : Control {
13
+ pub mv struct Toggle: Control {
14
14
  var uint64 handle = 0
15
15
 
16
16
  // The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
17
17
  // twin (same public bare-self methods, no destroy) so closures can
18
18
  // capture this control without moving it. See GUI.md, "Handles".
19
- #handle = () {}
19
+ #handle = () { }
20
20
 
21
21
  pub func #init = (self, Window window, string title) {
22
22
  ```
@@ -109,7 +109,7 @@ pub mv struct Toggle : Control {
109
109
  ```
110
110
  }
111
111
 
112
- pub func set_frame = (ref self, int x, int y, int width, int height) {
112
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
113
113
  ```
114
114
  #arch: c
115
115
  #platform: macos
@@ -17,7 +17,7 @@
17
17
  * already make). macOS-only (NSToolbar has no iOS counterpart; see GUI_PLAN
18
18
  * Tier 2 — the iOS blocks are TODO stubs).
19
19
  **/
20
- pub mv struct Toolbar : Control {
20
+ pub mv struct Toolbar: Control {
21
21
  var uint64 handle = 0
22
22
 
23
23
  // File-scope helper: the shared delegate + action recorder (shared — one
@@ -456,7 +456,7 @@ pub mv struct Toolbar : Control {
456
456
  // ── Control trait conformance ──
457
457
  // A toolbar is window chrome: the layout engine never frames it (AppKit
458
458
  // owns the layout rect and shrinks the contentView itself).
459
- pub func set_frame = (ref self, int x, int y, int width, int height) {
459
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
460
460
  // No-op: the NSWindow carries the toolbar's geometry.
461
461
  }
462
462
 
@@ -1190,7 +1190,7 @@ pub mv struct Window: Control {
1190
1190
  // frame where the content rect changed. The grid must outlive the run
1191
1191
  // (an app field — registration stores its address). Call from
1192
1192
  // App.start; also arms the resize delegate's target pair.
1193
- pub func set_content = (ref self, ref Container grid) {
1193
+ pub func set_content = (ref self {}, ref Container grid { aligns, cols, dirty, dirty_idx, gaps, grows, h_kinds, h_vals, handles, kinds, measured_count, mh, mw, pads, pars, prh, prw, prx, pry, rh, rw, rx, ry, shrinks, spans, w_kinds, w_vals }) {
1194
1194
  ```
1195
1195
  #arch: c
1196
1196
  #platform: macos
@@ -1307,6 +1307,12 @@ pub mv struct Window: Control {
1307
1307
  // FORCED: it bypasses the close_requested interception (the delegate's
1308
1308
  // windowShouldClose: sees nomen_close_forced and allows). Only the red
1309
1309
  // button routes through `close_requested`.
1310
+ //
1311
+ // The forced latch is one-shot: it is armed immediately before
1312
+ // performClose: (which dispatches windowShouldClose: synchronously) and
1313
+ // disarmed right after. Left armed it is process-global — every LATER
1314
+ // red-button close (another window, a later run loop) would silently
1315
+ // bypass App.close_requested forever.
1310
1316
  pub func close = (self) {
1311
1317
  ```
1312
1318
  #arch: c
@@ -1314,6 +1320,7 @@ pub mv struct Window: Control {
1314
1320
  extern int nomen_close_forced;
1315
1321
  nomen_close_forced = 1;
1316
1322
  ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("performClose:"), (id)0);
1323
+ nomen_close_forced = 0;
1317
1324
  ```
1318
1325
  ```
1319
1326
  #arch: aarch64_use_c
@@ -1321,6 +1328,7 @@ pub mv struct Window: Control {
1321
1328
  extern int nomen_close_forced;
1322
1329
  nomen_close_forced = 1;
1323
1330
  ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("performClose:"), (id)0);
1331
+ nomen_close_forced = 0;
1324
1332
  ```
1325
1333
  ```
1326
1334
  #arch: c
@@ -1345,7 +1353,7 @@ pub mv struct Window: Control {
1345
1353
  // a FrameEvents each frame.
1346
1354
  // The app is consumed: it is destroyed when the loop exits (controls
1347
1355
  // release, buffers free).
1348
- pub func run = (ref self, mv App app) {
1356
+ pub func run = (ref self {}, mv App app) {
1349
1357
  app.start(ref self)
1350
1358
  Container.arm_resize_delegate(self)
1351
1359
  self.arm_mouse_moves()
@@ -1354,7 +1362,7 @@ pub mv struct Window: Control {
1354
1362
  self.relayout(1)
1355
1363
  var int prev_w = self.content_width()
1356
1364
  var int prev_h = self.content_height()
1357
- var FrameEvents ev = FrameEvents()
1365
+ var ev = FrameEvents()
1358
1366
  while self.is_visible() {
1359
1367
  // Close interception: the delegate refused the native close and
1360
1368
  // set the pending flag; consult the app. Accept → forced close
@@ -1432,7 +1440,7 @@ pub mv struct Window: Control {
1432
1440
  return s
1433
1441
  }
1434
1442
 
1435
- pub func set_frame = (ref self, int x, int y, int width, int height) {
1443
+ pub func set_frame = (ref self {}, int x, int y, int width, int height) {
1436
1444
  ```
1437
1445
  #arch: c
1438
1446
  #platform: macos
@@ -1853,7 +1861,6 @@ pub func nomen_control_take_input = (uint64 handle, out bool) {
1853
1861
  ```
1854
1862
  }
1855
1863
 
1856
-
1857
1864
  pub func nomen_window_clicks_init = (uint64 handle) {
1858
1865
  ```
1859
1866
  #arch: c
@@ -71,9 +71,13 @@ pub mv struct Fiber<T> : Spawnable<T> {
71
71
  // out of the instance (started; #destroy no-ops), return the handle.
72
72
  // While the fiber waits, it parks and frees its worker instead of
73
73
  // blocking it.
74
- pub func start = (ref self, mv out Task<T>) {
74
+ pub func start = (ref self {}, mv out Task<T>) {
75
75
  ```
76
76
  #arch: c
77
+ // Single-launch contract: a consumed construction (started) owns
78
+ // nothing — the handles below are zeroed, and writing the ref count
79
+ // through the null future would fault. Abort with the reason.
80
+ if (self->started) __nomen_spawn_double_start_abort();
77
81
  struct nomen_future *_f = (struct nomen_future *)self->future;
78
82
  _f->refs = self->nursery_futures ? 3 : 2;
79
83
  __nomen_fiber_spawn((struct nomen_closure *)self->task, _f);
@@ -83,7 +87,12 @@ pub mv struct Fiber<T> : Spawnable<T> {
83
87
  ```
84
88
  ```
85
89
  #arch: aarch64
86
- // x19 = self. f = self->future (#32); nursery_futures at #48.
90
+ // x19 = self. started at #40; f = self->future (#32); nursery_futures
91
+ // at #48. Single-launch contract first: a consumed construction has
92
+ // zeroed handles, and the ref-store below would write through null.
93
+ ldrb w9, [x19, #40]
94
+ cbnz w9, .Lnomen_fstart_double
95
+ // f = self->future (#32); nursery_futures at #48.
87
96
  ldr x0, [x19, #32]
88
97
  ldr x1, [x19, #48]
89
98
  mov w2, #2
@@ -103,6 +112,10 @@ pub mv struct Fiber<T> : Spawnable<T> {
103
112
  ldr x3, [x19, #32]
104
113
  bl ___nomen_nursery_track
105
114
  .Lnomen_fstart_notrack:
115
+ b .Lnomen_fstart_done
116
+ .Lnomen_fstart_double:
117
+ bl ___nomen_spawn_double_start_abort
118
+ .Lnomen_fstart_done:
106
119
  ```
107
120
  var t = Task<T>()
108
121
  t.result_slot = self.result_slot
@@ -122,7 +135,7 @@ pub mv struct Fiber<T> : Spawnable<T> {
122
135
  // The fiber is launched exactly like start, but the handle is dropped
123
136
  // immediately: the future's refs are released as the discarded Task is
124
137
  // reclaimed, and the fiber completes into the void — nothing joins it.
125
- pub func detach = (ref self) {
138
+ pub func detach = (ref self {}) {
126
139
  self.start()
127
140
  }
128
141
 
@@ -14,7 +14,7 @@ pub mv struct Graph<T>: Enumerable {
14
14
  var node_count = 0
15
15
  var edge_count = 0
16
16
 
17
- pub func add_node = (ref self, mv T value) {
17
+ pub func add_node = (ref self { head_edge, values }, mv T value) {
18
18
  var int idx = self.node_count
19
19
  self.values.grow(idx + 1)
20
20
  self.values.store(idx, value)
@@ -23,7 +23,7 @@ pub mv struct Graph<T>: Enumerable {
23
23
  self.node_count = self.node_count + 1
24
24
  }
25
25
 
26
- pub func add_edge = (ref self, int from, int to) {
26
+ pub func add_edge = (ref self { edge_next, edge_target, head_edge }, int from, int to) {
27
27
  var int e = self.edge_count
28
28
  self.edge_target.grow_int(e + 1)
29
29
  self.edge_target.store_int(e, to)
@@ -13,10 +13,19 @@ pub mv struct LinkedList<T>: Enumerable {
13
13
  var int head = -1
14
14
  var count = 0
15
15
 
16
- pub func add = (ref self, mv T value) {
16
+ pub func add = (ref self { nexts, prevs, values }, mv T value) {
17
17
  var int idx = self.count
18
18
  self.values.grow(idx + 1)
19
- self.values.store(idx, value)
19
+ // The value arrives owned (`mv T value`): move a value-struct element
20
+ // that OWNS resources into the fresh slot (the caller's storage
21
+ // zeroes, no deep copy). A non-owning value struct is a legal bare
22
+ // argument, so it keeps the copying store; strings keep the
23
+ // deep-copying store too (their pair arrives by value).
24
+ if T_TAKES_OWNERSHIP {
25
+ self.values.store_take(idx, value)
26
+ } else {
27
+ self.values.store(idx, value)
28
+ }
20
29
  self.nexts.grow_int(idx + 1)
21
30
  self.nexts.store_int(idx, -1)
22
31
  self.prevs.grow_int(idx + 1)
@@ -27,14 +36,14 @@ pub mv struct LinkedList<T>: Enumerable {
27
36
  }
28
37
  }
29
38
 
30
- pub func set_next = (ref self, int idx, int next) {
39
+ pub func set_next = (ref self { nexts, prevs }, int idx, int next) {
31
40
  self.nexts.store_int(idx, next)
32
41
  if next >= 0 && next < self.prevs.cap {
33
42
  self.prevs.store_int(next, idx)
34
43
  }
35
44
  }
36
45
 
37
- pub func set_previous = (ref self, int idx, int prev) {
46
+ pub func set_previous = (ref self { nexts, prevs }, int idx, int prev) {
38
47
  self.prevs.store_int(idx, prev)
39
48
  if prev >= 0 && prev < self.nexts.cap {
40
49
  self.nexts.store_int(prev, idx)