[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] GSL Shell new beta release with anti-gran graphics module
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 3 Dec 2009 13:29:19 +0200
On Thu, Dec 3, 2009 at 1:00 PM, David Kastrup <firstname.lastname@example.org> wrote:
> Is this
> fun2(function(x) return x*x end, x)
> fun2(function(x) return x*x, x end)
Well, that did shut me up briefly, I'll grant you that.
But I still think that Miles had a valid point when he said that small
expressions can be overwhelmed by the function...return..end
machinery. Perhaps we are simply so used to anonymous functions that
we have learned to skim over them, much as C etc programmers see that
old nastiness 'for(i = 0; i < n; i++)' as one blob of information?
In Penlight we went to some trouble to introduce placeholder
expressions, so that _1*_1 would resolve as something that could be
_compiled_ to function(x) return x*x end. But it cannot cover all of
Lua's expression syntax, since 'or' is not an operator, '==' insists
that both arguments are the same type, etc.
It's possible that a relative newbie to Lua would be more comfortable
with the short notation (especially one with mathematical needs),
which modifies one line of the syntax:
function ::= function funcbody | `|` [parlist] `|` exp
Which BTW, means that it's the first meaning ;)