refactor(units): vec3_homogeneous_ops! macro — single-source Vec3 boilerplate #40
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "patman/uom-vec-macro"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
Replaces the seven hand-copied
add/sub/scale/magnitudebodies across the*Vec3boundary types with a singlevec3_homogeneous_ops!macro (common/src/types/units/vec_ops.rs). Pure, behavior-preserving refactor.Why
The seven copies were a live unit-bug surface — each re-typed the SI accessor, so a single wrong accessor (e.g.
as_millimetersforas_meters) would be a silent unit bug that compiles and passes a same-unit round-trip test. The macro makes the SI accessor a single source of truth. It also unblocks the line budget for the typed-vector seam (next PR) and only ever generates dimension-homogeneous boilerplate — never dimensional algebra.Verification
buck2 build //common:commongreen;buck2 test //common:common-tests→ 89 passed. The existing per-type proptests (vec3_add_then_sub_identity,vec3_magnitude_matches_pythagoras,vec3_scale_by_one_is_identity, angular equivalents) are the regression net and pass unchanged. Net −165 lines.Stack position
PR 0 of the typed-vector/CAM series, on top of #39. Foundation for #41+ (SI-array seam, typed ops, integrator). Part of the night-session build — see
docs/superpowers/cam-typed-layer-design.md.