lua-users home
lua-l archive

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


> From: "Adam D. Moss" <adam@gimp.org>

> No, I don't believe so -- since 'everything' is dynamic, it
> can't know that a function is empty until the moment it's
> called.

    if ( function ) then function() end seems the way to go then.

> (It'd probably be feasible for Lua to inline functions
> and turn your empty function calls into no-ops ahead of time if
> your functions were 'local' and Lua had the notion of constant
> objects, but it doesn't.)

    I would suppose that a simple bit flag set during the compile could mark
empty functions which Lua could then ignore.  A very small win which only
really helps code clarity.  It wouldn't be as good as having Lua do some
real inlining during compilation as you suggest.  Ooohh... and const
objects.... one can dream. =)

    Tom