Simon Brunning <SBrunning at trisystems.co.uk> writes: > I can't see how this optimisation could be automated - function f may or may > not have side effects. Checking whether f has side effects can be automated. Of course, you need a fallback strategy for when f gets rebound between when the code is compiled and when it is run.