lua-users home
lua-l archive

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


Mark Hamburg wrote:
[...]
But imagine a chunk keyword (anathema I know to add a keyword, but imagine it none the less).

This sounds like perfect fodder for something like metalua. The string
could be hoisted out of the expression where it's used, compiled to
bytecode at the top level, assertion checked for upvalues, etc, all
quite easily:

fn(chunk print("Hello, world!") end)

==>

local __chunk1 = function() print("Hello, world!") end
checkNoUpvalues(__chunk1)
...
fn(__chunk1)

Metalua might be a bit heavyweight for just this, though --- I have
vague recollections that there's a more lightweight form of syntax
extension available, but can't for the life of me remember what it is.

--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "They laughed at Newton. They laughed at Einstein. Of course, they
│ also laughed at Bozo the Clown." --- Carl Sagan