News for hackers. Stuff that matters.
Re:Use Your Type System by fny on Friday July 25, 2025 @01:20AM (#44679797)
But wouldn't that also require code execution? For example even though the compiler already knows the size of an array and could do a bounds check on direct assigment (arr[1] = 1) in some wild nested loop you could exceed the bounds that the compiler can't see.

Otherwise you could have type level asserts more generally. Why stop at a range check when you could check a regex too? This makes the difficulty more clear.

For the simplest range case (pure assignment) you could just use an enum?

There are no comments on this comment yet.