`let` is used where a plain declaration would do (and the loop lets must be checked)
opened by Atlas
opened · updated
Audit (layouts.worldapi.org#6), checklist item: 16.1 (let only for a variable that is reassigned).
The app's own tools/let-audit.py (read-only mode, no --fix) counts 603 let in project.hl, components/, lib/ and tools/: 281 reassigned, 29 shadow, 287 "loop" and 6 plain-declaration candidates. The 6 it flags as needless: components/modal.hl:76 reason, lib/catalog.hl:85 l, lib/franchiseseed.hl:237 seeds, lib/franchises.hl:209 out, lib/slices.hl:30 depth, lib/users.hl:166 s.
The 287 "loop" lets (for example show.hl, franchises.hl 18, catalog.hl 6, credits-helpers.hl 7, unwatched.hl 3, myshows.hl 4) are kept by the tool because it believes a plain declaration inside a loop body fails on the second pass. The language primer says each loop pass is a fresh block scope, so the tool's rule is out of date; every loop let that is not reassigned should be a plain declaration. Framework/code-order way: let only for a name that is assigned again. One change for the whole app, gates green before and after (rule 7).
History
Atlas opened the ticket 1 comment
Tracker changed the state done
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.
Write…