Migration to 0.2.0-dev
Additional changes in 0.3.0-dev
- Annotations now enforce contracts. Correct mismatches, remove annotations for
dynamic code, or use
Any. The integer annotation isInt. try,catch,throw,record, andenumare new reserved keywords for bindings; map keys and property names may use keywords.zy checkalso validates known contracts and imported exports without running code. Dynamic values remain runtime-checked.- IP parsers now accept IPv6, and split/allocation support both address families.
- Projects can use
zy.json, isolatedzy testfunctions, and locked local dependencies. See projects and types/errors.
The older numeric migration details below still apply.
This development version changes numeric behavior and rejects previously tolerated invalid programs. No stable release has been published by this update.
| Previous behavior | Current behavior | Required adjustment |
|---|---|---|
7 / 2 returned integer 3 | Returns Float 3.5 | Use div(7, 2) for integer division |
Exact integer division displayed 2 | 4 / 2 displays 2.0 | Use div() or explicitly convert if integer output is intended |
| Out-of-range literals silently saturated | Located syntax error | Use in-range integers or an explicit finite Float |
| Integer arithmetic lost precision or overflowed | Exact values or overflow errors | Fix bounds; explicitly convert to Float only when rounding is acceptable |
| Invalid math returned NaN/Inf | Located runtime error | Check mathematical domains and magnitudes |
break/continue outside a loop were ignored | Syntax error, including inside a nested function | Move control flow into a loop in that function |
Top-level return stopped execution | Syntax error | Use a function; use assert() to signal a failed script |
| Extra method arguments could be ignored | Argument-count errors | Match documented signatures |
string.split() used an implicit space | Explicit separator required | Write string.split(" ") |
| List sort mixed strings/numbers | Requires all numbers or all strings | Normalize or separate values before sorting |
| A collection did not equal its own alias | Identity equality for collections | Separate collections with identical content still compare unequal |
| Allocating huge ranges/splits was unbounded | Limit of 65,536 entries | Divide work into smaller inputs |
import, export, and as were valid identifiers | Reserved module keywords | Rename variables, parameters, or other identifiers using these words |
zy file.zy remains supported. zy run file.zy and zy check file.zy are additional commands. Script arguments follow the filename; args() exposes them. Use zy run --timeout=2s file.zy for a cooperative deadline.
check validates syntax, control-flow context, and the complete local import graph. It now reads dependency source and rejects missing imports, cycles, and graph-limit violations. It does not type-check dynamic values, check undefined expression names or exported member accesses, read input JSON, or execute policies.
Use local modules for reusable code and CLI tooling for fmt, fmt -w, and fmt --check. Formatting preserves inline layout and statement boundaries. No existing file is reformatted automatically.
Read numeric semantics, runtime limits, and standard library for the exact contracts.