@calcit/procs 0.13.39 → 0.13.41

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.
Binary file
@@ -7,7 +7,7 @@
7
7
 
8
8
  在不掩盖现有运行时行为的前提下,让类型系统逐步阻止业务代码依赖 `nil`:
9
9
 
10
- - 无业务返回值使用 `Unit`(运行时暂仍由 `nil` 承载);
10
+ - 无业务返回值使用 `Unit`,新代码以独立的 `&unit` 值表示;
11
11
  - 正常的“可能缺失”最终使用名义类型 `Option<T>`;
12
12
  - 可恢复失败使用 `Result<T, E>`;
13
13
  - JavaScript `null`/`undefined` 只通过 `JsNullish<T>` 进入类型系统;
@@ -64,7 +64,7 @@
64
64
 
65
65
  ### Unit
66
66
 
67
- `Unit` 只用于副作用操作或明确没有有意义返回值的表达式,例如写文件、注册 watcher。运行时目前仍由 `nil` 承载 Unit,但源码不应因此显式返回 `nil` `;nil`:空函数体直接声明 `Unit`,有副作用的函数让最后一个 Unit effect 自然成为返回项。只有语法必须提供占位节点时才保留 `;nil`,业务代码不得把它当缺失值容器。
67
+ `Unit` 只用于副作用操作或明确没有有意义返回值的表达式,例如写文件、注册 watcher。新代码显式返回 `&unit`;它与 `nil` 不相等、不会通过 `nil?`,JavaScript 后端生成 `void 0`(而 `nil` 仍生成 `null`)。为了兼容既有代码,标注为 `Unit` 的位置仍可接受旧的 `nil`,而 `;nil` 也保留为旧的兼容宏;新业务代码不得把两者当 Unit 标记或缺失值容器。
68
68
 
69
69
  ### Optional<T>(遗留内部表示)
70
70
 
@@ -237,7 +237,7 @@ defstruct NodeProbe
237
237
  ```
238
238
 
239
239
  当前 probe 使用 `Map<Tag, Dynamic>`,应迁移成命名 Struct。Storage mutation、console、
240
- timer registration 等只有副作用的 wrapper 应显式以 `nil` 收尾并声明返回 `Unit`,不因
240
+ timer registration 等只有副作用的 wrapper 应显式以 `&unit` 收尾并声明返回 `Unit`,不因
241
241
  JavaScript 返回 `undefined` 就暴露 `Dynamic`。
242
242
 
243
243
  ## 类型表达案例目录
@@ -0,0 +1,23 @@
1
+ # option:fold shared callback return type
2
+
3
+ - Higher-order callback matching must reuse the enclosing generic binding map.
4
+ A fresh map per callback makes repeated variables such as `option:fold`'s
5
+ return `U` independent and silently accepts incompatible branch results.
6
+ - Unhinted zero-argument thunks may safely retain a concrete return type from
7
+ their final expression. This supplies the none-branch binding for `U` while
8
+ keeping unhinted callbacks with parameters dynamic, avoiding retroactive
9
+ tightening of existing higher-order call sites.
10
+ - The inferred thunk annotation must preserve `SchemaKind::Macro` for
11
+ `defmacro` forms, matching the explicit-hint path; a dedicated regression
12
+ test prevents zero-argument macros from being exposed as ordinary functions.
13
+ - Callback signature matching stages generic bindings and commits them only on
14
+ success, so a rejected nested callback cannot constrain a later argument.
15
+ `option:fold` additionally recovers a concrete return type for unhinted
16
+ callback bodies during its own argument check, including parameterized
17
+ callbacks, without globally tightening unrelated higher-order calls.
18
+ - Preprocessing regressions cover direct folds, parameterized callbacks, and a
19
+ user macro expanding to `option:fold`; empty unhinted functions remain
20
+ dynamic rather than treating their parameter list as a return value.
21
+ - Regression coverage includes the shared-binding matcher and literal thunk
22
+ inference. The CLI reproduction now fails during preprocessing when a
23
+ `String` none branch is combined with a numeric Option payload and `identity`.
@@ -0,0 +1,4 @@
1
+ # Release 0.13.40
2
+
3
+ - Release the merged `option:fold` callback return-type enforcement from PR #397.
4
+ - Keep the Cargo crate and npm package versions aligned, then refresh the workspace lockfile before tagging from `main`.
@@ -0,0 +1,14 @@
1
+ # Explicit Unit literal
2
+
3
+ - Added `&unit` as a distinct runtime `Calcit::Unit` value. It is intentionally
4
+ not a bare `unit` identifier, so existing programs can continue to bind a
5
+ local named `unit`.
6
+ - `&unit` has its own equality, hashing, display, parser/data conversion and
7
+ `type-of` result. JavaScript emits `void 0`, whereas legacy `nil` continues
8
+ to emit `null`.
9
+ - Unit schemas accept both `&unit` and legacy `nil` to preserve existing source
10
+ compatibility. JSON refuses to encode `&unit` so it cannot silently become
11
+ a nullable application value.
12
+ - Updated JS, IR and WASM code generation plus data-shape validation and
13
+ documentation. The parser/codegen tests cover the literal and the backend
14
+ suite passes.
@@ -0,0 +1,5 @@
1
+ # Release 0.13.41
2
+
3
+ - Published the explicit `&unit` literal added in PR #402.
4
+ - Kept the Cargo crate and `@calcit/procs` package versions aligned so projects
5
+ can compile and run code that returns the distinct Unit value.
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.13.39",
3
+ "version": "0.13.41",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.7.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.13.39",
3
+ "version": "0.13.41",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.7.0",