lua-users home
lua-l archive

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


On Mon, Feb 8, 2010 at 5:40 AM, Doug Rogers <doug@dkrogers.com> wrote:
> The '|args|expression' form is good for 'function(args) return expression
> end', though I think it would fit better with some sort of closing token.

I like lhf's lambda-style proposal, e.g. \x,y(x+y) - has two
advantages (a) it is absolutely explicit about what the expression
scope is (and can also support multiple return values) and (b) it is
easily implemented by token filters (e.g. using LuaMacro)

Yes, I do like |x,y| x+y  but handling the end-of-expression is ...
awkward (and probably for that reason, a problem for people as well)

One could allow ',',')' and ';' to be mandatory closing tokens here
and then it's implementable using token filters. (But then it can bite
your ass when you leave off the closing token!)

We like to keep Lua sugar-free as much as possible, so first prize
would be some acceptable form of token filter. I've had some ideas,
but I'm not sure if there's enough call for pushing this much further.
 A first pass would be to patch the token filter patch so that it did
not rely on the presence of a global 'FILTER' (that is, there was an
API which would explicitly register callbacks.)

> form that accepts statements would be nice, too, but I think it would be too
> far from Lua's essence,

Yes, that kind of function needs to be more visible.

steve d.