Dan Sugalski wrote:
> It's not like this is expensive in the simple case, but when you do 
> something like:
> 
>    (1 / sin(2.3)) * log(4)
> 
> in a loop, well, that can add up pretty quickly.

And in this case we have to assume that sin and log are pure functions, 
in addition to assuming that they will never be redefined. Sure, you can 
make sin and log special cases, but where do you stop?

Anyway, why would one have such a complex expression within a loop? It's 
not like in C where an apparently simple expression can be expanded by 
the preprocessor into something that needs a lot of folding. The 
complexity of the expression is apparent in the ruby code, and it is 
telling you to move it out of the loop.