[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Short function definition syntax; thoughts on Lua (was Re: [ANN] GSL Shell new beta release...)
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 4 Dec 2009 12:32:50 +0200
On Fri, Dec 4, 2009 at 12:12 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
> function (x,y,z)=x+y*z
> which is reminiscent of Fortran one-line function statements except that
> defines anonymous functions.
But it looks like an assignment...
The word 'lambda' has a long history, as long as function probably. A
new keyword because it's so awkward to find end-of-expression without
help from the parser.
Was thinking about Fortran one-line functions in the context of 'short
form' anonymous functions, as an example of an extra optional feature
which does little harm.
> This syntax is even friendlier to token filters because you only need to
> convert '=' to 'return' but the real problem is of course how to detect
> the end of the expression so that 'end' can be added.
This is precisely the problem for lexical solutions.
I confess to being a little puzzled at why people get so excited about
the short form. It's just a convenient abbreviation, a little bit of
sugar. Neither does it establish a precedent, since the Lua authors
have never been known to be railroaded into _anything_ they didn't
like ;)
steve d.