4 ms·
> Actually no, compilers can't assume that `foo` is const. They can assume it, they just need to be able to reverse that assumption if you do change it through
by chrisseaton 7y ago
> Actually no, compilers can't assume that `foo` is const.
They can assume it, they just need to be able to reverse that assumption if you do change it through something like eval. This is called 'speculative optimisation' and we use it to optimise languages like JavaScript, Ruby, Python, etc.
- deleted 7y ago[deleted]