Skip to content

Commit c94461a

Browse files
fix(stdlib): rename total var -> tot (#135 slice 4) (#168)
#135 slice 4 — the triage hypothesised a block/statement LR ambiguity for testing.affine:302 / math.affine:354. Precise isolation disproved that: every minimal block/stmt shape parses. The real cause is keyword-as-identifier (slice-6 class): `total` is the `TOTAL` reserved keyword (totality marker, `total fn`), so `let total = …` fails to parse. `let total = 0.0; …` fails; `let tot = 0.0; …` parses. Rename the `total` *variable* -> `tot` in math.affine `mean`/ `sum_float` (also `let mut`, they reassign in a loop) and testing.affine `bench`. The `total_time` record field is a different identifier (`total` only when bare) and is left unchanged; string-literal "total" text untouched. Pure stdlib rename — zero grammar/compiler risk. Effect: math.affine PARSE 354 -> RESOLVE; testing.affine PARSE 302 -> TYPECHECK (both clear the parse wall, advance to distinct deeper defects). traits.affine:124 is unrelated (`while let` pattern binding) — a genuine separate construct, still tracked. Suite unaffected (stdlib-only). Advances #135. Refs #128, #135. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ebec5c6 commit c94461a

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

stdlib/math.affine

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,18 +351,18 @@ fn mean(values: [Float]) -> Float {
351351
if n == 0 {
352352
return 0.0;
353353
}
354-
let total = 0.0;
354+
let mut tot = 0.0;
355355
for v in values {
356-
total = total + v;
356+
tot = tot + v;
357357
}
358-
total / to_float(n)
358+
tot / to_float(n)
359359
}
360360

361361
/// Sum of a list of floats
362362
fn sum_float(values: [Float]) -> Float {
363-
let total = 0.0;
363+
let mut tot = 0.0;
364364
for v in values {
365-
total = total + v;
365+
tot = tot + v;
366366
}
367-
total
367+
tot
368368
}

stdlib/testing.affine

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,11 @@ fn bench(f: () -> (), iterations: Int) -> BenchResult {
299299
i = i + 1;
300300
}
301301

302-
let total = time_now() - start;
302+
let tot = time_now() - start;
303303
{
304304
iterations: iterations,
305-
total_time: total,
306-
avg_time: total / (iterations + 0.0)
305+
total_time: tot,
306+
avg_time: tot / (iterations + 0.0)
307307
}
308308
}
309309

0 commit comments

Comments
 (0)