ulox
ulox copied to clipboard
Determine value of consts
There is presently no way to prevent or signal that a variable is not allowed or expected to be modified. Meaning some one cannot enforce the value of PI.
If valued, propose draft.
For value types/litterals this could happen at the compiler stage, the variable lookup finding a match and that match indicating it is a constant literal can push the literal rather than emiting the getlocal/global/prop etc.
For consts that hold expressions, either run them ahead of time or store their results and flag them as readonly/records.
While constants are valuable, they are not critical, we can make do just fine without them for a while.
With readonly
now in place for instances, we just need the ability to prevent sets on locals.