@calcit/procs 0.13.41 → 0.13.43

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
@@ -0,0 +1,9 @@
1
+ # Guard eager range construction
2
+
3
+ - Capped eager range cardinality at the JavaScript array length limit in both
4
+ Native and JavaScript backends, returning the same controlled error before
5
+ iteration.
6
+ - Detect floating-point steps that no longer change the current value, avoiding
7
+ infinite loops at large magnitudes.
8
+ - Added Native regression coverage for oversized and non-advancing ranges; the
9
+ shared Calcit regression runs through Native and JavaScript integration suites.
@@ -0,0 +1,13 @@
1
+ # range backend consistency and allocation
2
+
3
+ - Native and JavaScript `range` now reject non-finite inputs and use exact
4
+ equality for the empty half-open interval, avoiding divergent edge behavior.
5
+ - JavaScript range generation handles negative steps and fills one backing
6
+ array directly instead of creating a new `CalcitSliceList` wrapper for every
7
+ item. A local 20 × 200,000-item benchmark improved from 40.96 ms to 20.71 ms.
8
+ - Native range generation reserves the estimated vector capacity with
9
+ `try_reserve_exact`, retaining the existing iterative floating-point behavior
10
+ while avoiding repeated vector growth and reporting impossible allocations.
11
+ - Regression coverage runs descending and fractional ranges in the native and
12
+ JavaScript project suites; definition-attached tests also cover descending
13
+ ranges in `calcit.core`.
@@ -0,0 +1,6 @@
1
+ # Align Unit truthiness across runtimes
2
+
3
+ - Treat `&unit` as false in native conditionals and `not`, matching JavaScript (`void 0`) and WebAssembly (`0`).
4
+ - Make `or` use the shared conditional semantics, then add a Unit regression test.
5
+ - Replace internal no-return `;nil` tails with `&unit`, while retaining `;nil` for legacy absence semantics.
6
+ - Cover `json-stringify &unit` as a type error.
@@ -0,0 +1,4 @@
1
+ # Complete project-module merge review coverage
2
+
3
+ - Avoid cloning a dependency snapshot when it has no namespaces owned by the project package.
4
+ - Extend the transitive self-dependency regression to cover project subnamespaces and preserve strict conflicts for unrelated namespaces.
@@ -0,0 +1,5 @@
1
+ # Complete Unit effect-return review
2
+
3
+ - Document that `not` accepts Unit as a falsey input in its builtin help and core documentation.
4
+ - Ensure `each` and `&doseq` discard callback or body values and return Unit for non-empty traversals.
5
+ - Add definition-attached Unit regressions for both traversal helpers.
@@ -0,0 +1,6 @@
1
+ # Reconcile concrete data-definition schemas in scaffold plans
2
+
3
+ - Accept an existing concrete `StructDef` or `EnumDef` schema when a scaffold plan declares the corresponding broad definition-kind marker.
4
+ - Decode zero-payload canonical schema wrappers consistently at both snapshot-load and write-validation boundaries, avoiding their accidental interpretation as anonymous enum values.
5
+ - Keep the compatibility rule directional and limited to data-definition schemas so unrelated function and value schemas remain strict.
6
+ - Cover both struct and enum definition markers with a regression test.
@@ -0,0 +1,10 @@
1
+ # Skip transitive copies of the project package
2
+
3
+ - A project's direct dependency can reintroduce that same package through a
4
+ transitive dependency. Current namespace collision checks then rejected the
5
+ project source during normal compile and static-analysis commands.
6
+ - Added a project-level merge path that drops only namespaces belonging to the
7
+ root package before applying the existing strict module merge. Direct module
8
+ conflict checks remain unchanged.
9
+ - Added a regression test and verified the real respo-markdown project against
10
+ the current Respo dependency graph.
@@ -0,0 +1,6 @@
1
+ # Release 0.13.42
2
+
3
+ - Publish the project-module merge fix from PR #404.
4
+ - This permits a library to validate itself when a direct dependency includes
5
+ the same package transitively, while preserving strict cross-package module
6
+ conflicts.
@@ -0,0 +1,5 @@
1
+ # Release 0.13.43
2
+
3
+ - Align Unit truthiness across native, JavaScript, and WASM runtimes.
4
+ - Reconcile existing `StructDef` and `EnumDef` definitions with matching scaffold architecture markers.
5
+ - Include the range backend consistency and performance improvements merged after 0.13.42.
@@ -139,7 +139,7 @@ export declare let _$n_map_$o_dissoc: (xs: CalcitValue, ...args: CalcitValue[])
139
139
  export declare let reset_$x_: (a: CalcitRef, v: CalcitValue) => null;
140
140
  export declare let add_watch: (a: CalcitRef, k: CalcitTag, f: CalcitFn) => null;
141
141
  export declare let remove_watch: (a: CalcitRef, k: CalcitTag) => null;
142
- export declare let range: (n: number, m: number, step?: number) => CalcitSliceList | CalcitList;
142
+ export declare let range: (n: number, m?: number, step?: number) => CalcitSliceList;
143
143
  export declare function _$n_list_$o_empty_$q_(xs: CalcitValue): boolean;
144
144
  export declare function _$n_str_$o_empty_$q_(xs: CalcitValue): boolean;
145
145
  export declare function _$n_map_$o_empty_$q_(xs: CalcitValue): boolean;
@@ -802,23 +802,48 @@ export let remove_watch = (a, k) => {
802
802
  a.listeners.delete(k);
803
803
  return null;
804
804
  };
805
+ const MAX_RANGE_LENGTH = 4294967295;
805
806
  export let range = (n, m, step = 1) => {
806
- var result = new CalcitSliceList([]);
807
- if (m != null) {
808
- var idx = n;
809
- while (idx < m) {
810
- result = result.append(idx);
811
- idx = idx + step;
807
+ const base = m == null ? 0 : n;
808
+ const bound = m == null ? n : m;
809
+ if (!Number.isFinite(base) || !Number.isFinite(bound) || !Number.isFinite(step)) {
810
+ throw new TypeError("&list:range expected finite numbers for base, bound, and step");
811
+ }
812
+ if (base === bound) {
813
+ return new CalcitSliceList([]);
814
+ }
815
+ if (step === 0 || (bound > base && step < 0) || (bound < base && step > 0)) {
816
+ throw new Error("&list:range cannot construct list with a step of 0 or invalid step direction");
817
+ }
818
+ // Avoid overflowing `bound - base` when finite endpoints have opposite signs.
819
+ const estimatedLength = (base < 0) !== (bound < 0)
820
+ ? Math.ceil(Math.abs(base) / Math.abs(step) + Math.abs(bound) / Math.abs(step))
821
+ : Math.ceil((bound - base) / step);
822
+ if (!Number.isFinite(estimatedLength) || estimatedLength > MAX_RANGE_LENGTH) {
823
+ throw new Error("&list:range result is too large");
824
+ }
825
+ const result = [];
826
+ if (step > 0) {
827
+ for (let value = base; value < bound;) {
828
+ result.push(value);
829
+ const next = value + step;
830
+ if (next === value) {
831
+ throw new Error("&list:range step does not advance the current value");
832
+ }
833
+ value = next;
812
834
  }
813
835
  }
814
836
  else {
815
- var idx = 0;
816
- while (idx < n) {
817
- result = result.append(idx);
818
- idx = idx + step;
837
+ for (let value = base; value > bound;) {
838
+ result.push(value);
839
+ const next = value + step;
840
+ if (next === value) {
841
+ throw new Error("&list:range step does not advance the current value");
842
+ }
843
+ value = next;
819
844
  }
820
845
  }
821
- return result;
846
+ return new CalcitSliceList(result);
822
847
  };
823
848
  export function _$n_list_$o_empty_$q_(xs) {
824
849
  if (xs instanceof CalcitList || xs instanceof CalcitSliceList)
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.13.41",
3
+ "version": "0.13.43",
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.41",
3
+ "version": "0.13.43",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.7.0",
@@ -889,22 +889,51 @@ export let remove_watch = (a: CalcitRef, k: CalcitTag): null => {
889
889
  return null;
890
890
  };
891
891
 
892
- export let range = (n: number, m: number, step: number = 1): CalcitSliceList | CalcitList => {
893
- var result: CalcitList | CalcitSliceList = new CalcitSliceList([]);
894
- if (m != null) {
895
- var idx = n;
896
- while (idx < m) {
897
- result = result.append(idx);
898
- idx = idx + step;
892
+ const MAX_RANGE_LENGTH = 0xffff_ffff;
893
+
894
+ export let range = (n: number, m?: number, step: number = 1): CalcitSliceList => {
895
+ const base = m == null ? 0 : n;
896
+ const bound = m == null ? n : m;
897
+
898
+ if (!Number.isFinite(base) || !Number.isFinite(bound) || !Number.isFinite(step)) {
899
+ throw new TypeError("&list:range expected finite numbers for base, bound, and step");
900
+ }
901
+ if (base === bound) {
902
+ return new CalcitSliceList([]);
903
+ }
904
+ if (step === 0 || (bound > base && step < 0) || (bound < base && step > 0)) {
905
+ throw new Error("&list:range cannot construct list with a step of 0 or invalid step direction");
906
+ }
907
+
908
+ // Avoid overflowing `bound - base` when finite endpoints have opposite signs.
909
+ const estimatedLength = (base < 0) !== (bound < 0)
910
+ ? Math.ceil(Math.abs(base) / Math.abs(step) + Math.abs(bound) / Math.abs(step))
911
+ : Math.ceil((bound - base) / step);
912
+ if (!Number.isFinite(estimatedLength) || estimatedLength > MAX_RANGE_LENGTH) {
913
+ throw new Error("&list:range result is too large");
914
+ }
915
+
916
+ const result: Array<CalcitValue> = [];
917
+ if (step > 0) {
918
+ for (let value = base; value < bound; ) {
919
+ result.push(value);
920
+ const next = value + step;
921
+ if (next === value) {
922
+ throw new Error("&list:range step does not advance the current value");
923
+ }
924
+ value = next;
899
925
  }
900
926
  } else {
901
- var idx = 0;
902
- while (idx < n) {
903
- result = result.append(idx);
904
- idx = idx + step;
927
+ for (let value = base; value > bound; ) {
928
+ result.push(value);
929
+ const next = value + step;
930
+ if (next === value) {
931
+ throw new Error("&list:range step does not advance the current value");
932
+ }
933
+ value = next;
905
934
  }
906
935
  }
907
- return result;
936
+ return new CalcitSliceList(result);
908
937
  };
909
938
 
910
939
  export function _$n_list_$o_empty_$q_(xs: CalcitValue): boolean {