lua-users home
lua-l archive

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


On Wed, Sep 30, 2009 at 1:06 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> (2) lexical
> substitution is often too stupid.

In this case, this is probably true ;)

With a suitable definition of checkNoUpvalues, one can do this:

macro.define('chunk',nil,'checkNoUpdates(function()')
macro.define('endchunk,nil,'end)')

Which is less than elegant. Accounting for matching ends and nested
chunks would be nasty.

However, it is probably better API design for the consumer of such
chunks to do the upvalues test itself, in which case chunk is trivial:

macro.define('chunk',nil,'function()')

BTW, I rather like Mr Storm's 'begin' token and begin-blocks being
allowed to be the argument of the preceding function without
parentheses. Nice for DSLs.

steve d.