Files
scriptc/packages/compiler
Chris Tate 71e118be7b Count loops bounded by a string's length in integers
A counted for loop needs a stable limit to run its counter in integer
storage. Array lengths qualified when the loop provably keeps them, but
a string's length did not, so `for (let i = 0; i < s.length; i++)`
kept a double counter and evaluated the length, through the UTF-16
mapping of a non-ASCII string, on every iteration. A string's length
cannot change, so it is now stable whenever the string's binding is
not rebound in the loop or boxed.
2026-10-21 21:42:23 -05:00
..
2026-10-21 19:34:10 -05:00
2026-10-20 19:27:58 -05:00
2026-07-22 18:08:04 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00