nomen-lang 0.9.0 → 0.11.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 (72) hide show
  1. package/core/System/Arena.nm +9 -7
  2. package/core/System/Array.nm +1 -1
  3. package/core/System/Atomic.nm +3 -3
  4. package/core/System/BigInt.nm +182 -23
  5. package/core/System/Buffer.nm +37 -35
  6. package/core/System/ClassBuffer.nm +18 -18
  7. package/core/System/Controls/Alert.nm +1 -1
  8. package/core/System/Controls/App.nm +5 -5
  9. package/core/System/Controls/Button.nm +1 -1
  10. package/core/System/Controls/CheckBox.nm +1 -1
  11. package/core/System/Controls/ColorPicker.nm +1 -1
  12. package/core/System/Controls/ComboBox.nm +1 -1
  13. package/core/System/Controls/Container.nm +34 -34
  14. package/core/System/Controls/DatePicker.nm +1 -1
  15. package/core/System/Controls/Form.nm +2 -2
  16. package/core/System/Controls/GroupBox.nm +1 -1
  17. package/core/System/Controls/ImageView.nm +1 -1
  18. package/core/System/Controls/Layout.nm +5 -5
  19. package/core/System/Controls/LevelIndicator.nm +1 -1
  20. package/core/System/Controls/ListView.nm +1 -1
  21. package/core/System/Controls/Menu.nm +1 -1
  22. package/core/System/Controls/NumberInput.nm +3 -3
  23. package/core/System/Controls/OtpInput.nm +2 -2
  24. package/core/System/Controls/OutlineView.nm +1 -1
  25. package/core/System/Controls/Pagination.nm +6 -6
  26. package/core/System/Controls/Popover.nm +1 -1
  27. package/core/System/Controls/Progress.nm +1 -1
  28. package/core/System/Controls/Radio.nm +1 -1
  29. package/core/System/Controls/Scrollable.nm +1 -1
  30. package/core/System/Controls/SearchField.nm +1 -1
  31. package/core/System/Controls/SecureField.nm +1 -1
  32. package/core/System/Controls/Segmented.nm +1 -1
  33. package/core/System/Controls/Select.nm +1 -1
  34. package/core/System/Controls/Separator.nm +1 -1
  35. package/core/System/Controls/Sheet.nm +1 -1
  36. package/core/System/Controls/Slider.nm +1 -1
  37. package/core/System/Controls/Spinner.nm +3 -3
  38. package/core/System/Controls/SplitView.nm +2 -2
  39. package/core/System/Controls/Stepper.nm +1 -1
  40. package/core/System/Controls/Switch.nm +1 -1
  41. package/core/System/Controls/Table.nm +1 -1
  42. package/core/System/Controls/Tabs.nm +1 -1
  43. package/core/System/Controls/Text.nm +1 -1
  44. package/core/System/Controls/TextBox.nm +1 -1
  45. package/core/System/Controls/TextView.nm +1 -1
  46. package/core/System/Controls/Toggle.nm +1 -1
  47. package/core/System/Controls/Toolbar.nm +1 -1
  48. package/core/System/Controls/Window.nm +11 -3
  49. package/core/System/Fiber.nm +16 -3
  50. package/core/System/Format.nm +751 -0
  51. package/core/System/Graph.nm +2 -2
  52. package/core/System/LinkedList.nm +8 -6
  53. package/core/System/List.nm +16 -13
  54. package/core/System/Map.nm +11 -9
  55. package/core/System/Random.nm +3 -3
  56. package/core/System/Set.nm +9 -7
  57. package/core/System/StableList.nm +7 -7
  58. package/core/System/Stream/File.nm +16 -16
  59. package/core/System/Stream/Http.nm +3 -3
  60. package/core/System/Stream/Tcp.nm +5 -5
  61. package/core/System/StringBuilder.nm +16 -16
  62. package/core/System/Task.nm +56 -64
  63. package/core/System/Test.nm +18 -18
  64. package/core/System/Text/Chars.nm +1 -1
  65. package/core/System/Text/Json.nm +12 -12
  66. package/core/System/Text/JsonTree.nm +8 -8
  67. package/core/System/Text/Regex.nm +20 -20
  68. package/core/System/Thread.nm +26 -3
  69. package/core/System/Tree.nm +19 -3
  70. package/dist/index.mjs +3423 -1849
  71. package/package.json +1 -1
  72. package/src/docs.ts +10 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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()
@@ -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
@@ -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