lua-users home
lua-l archive

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


> I agree. I think all statements should return values. That is a very powerful feature I'd like to see in Lua. Scheme, for example, has such a concept.

Moreover, statements should be first class: code in blocks like this:

do
  statement
  statement
  ...
end

should just be sugar for tables:

{
  statement,
  statement,
  ...
}

(an alternative syntax could be as for tables but without the commas,
sugared in the same way as semicolons in normal code).

This would allow blocks of code to be passed around and altered as in Lisp,
REBOL, Scheme &c.

The only problem I see is that it looks as though it's necessary to
recompile a block every time it's executed in case it's changed; in
practice, though, you can maintain two flags: one saying whether it's
compiled, and another saying whether it's changed. Or even, if you want to
avoid checking a flag every time you execute a block, you could have a
"const"-like specifier so that some blocks of code are compiled
once-and-for-all. You could have a convention that conventional code blocks,
like those between do...end, were constant, whereas code written as tables
could be dynamic. Anyway, these are problems solved by Lisp and Scheme, so
there's no killer problem here.

This gives Lua proper data == code.

-- 
http://sc3d.org/rrt/ | egrep, n.  a bird that debugs bison