[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] GSL Shell new beta release with anti-gran graphics module
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 3 Dec 2009 12:55:30 +0200
On Thu, Dec 3, 2009 at 12:27 PM, Francesco Abbate <gslshell@gmail.com> wrote:
> a usuful clean notation that could have its place in Lua.
Exactly, an alternative, not compulsory.
While dealing with Lua syntax extensions, it would occaisionally be
very useful to be able to drop the parentheses when calling functions
with a single argument which is an anonymous function, in the same way
as with string literals and table constructors.
E.g. Orbit's htmlify trick involves changing the function environment
so that unknown functions are assumed to represent HTML tags:
render = htmlify (function(web)
return html {
head { },
body { h2 'hello there' }
}
end)
That 'end)' is a little awkward, but this could be written so:
render = htmlify function(web)
return html {
head { },
body { h2 'hello there' }
}
end
Then together with 'short lambda' we get:
render = htmlify |web| html {
head { },
body { h2 'hello there' }
}
I'm not particularly attached to this notation, but it is consistent
(Lua already allows leaving out of parens in some cases; why not
another?)
steve d.