Files
make-cad/docs
NiJingzhe e06a4db3d5 feat: Var and Expr behave like numbers where Python asks for one
2.2.6 gave them symbolic arithmetic only; int(), round(), comparisons, max/min/sorted, range(n), [0] * n, lst[n - 1],
//, %, f"{r:.2f}" raised, and r == 5.0 / r in [5.0] answered False for a Var whose value is 5.0 (an agent lost ten
minutes in a scan-to-CAD run to a ql predicate with a Var-derived value that matched nothing).

Arithmetic stays an Expr (the formula); decisions read the value the expression has now (the value float(x) gives).
Two expressions compare by formula, an expression and a number by value; numpy scalars are accepted as operands.
Unchanged: bool(var) raises (an old test pins it), json.dumps(var) raises. There is no __array__ on purpose: marimo keys
an object that has one by its value alone, so a changed name, unit, tolerance or comment would no longer redo the cells
that read it (caught by test_cell_cache_store). __rmul__ hands list / str repetition back to Python.

A matrix test runs each usage with a number, a Var and an Expr and asserts the same answer. DEVIATIONS.md lists what
changed against 2.2.6; the notebook-runtime guide tells a model how to use a scad.var.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 17:35:54 +08:00
..