lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, 16 Feb 2011, Mike Pall wrote:
>
>   [...]
>   local a21 = 1/5
>   [...]
>   local function ode_dormandprince ( fxy , x0 , x1 , y0 , tol , hmax , hmin , maxiter )
>   [...]
>     while true do
>       local K2 = fxy ( x + c2*h, y + h*( a21*K1 ) )
>   [...]
>
> Rule #437: Never hoist out constants (if possible)!

When steve donovan proposed a "const" keyword earlier today, I wondered if
LuaJIT was able to spot that a local is only assigned to once so it could
automatically treat it as const.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
Forth, Tyne, Dogger: Mainly south or southeast, 5. Moderate or rough. Showers.
Moderate or good.