lua-users home
lua-l archive

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


steve donovan <steve.j.donovan@gmail.com> writes:

> On Fri, Dec 4, 2009 at 11:51 AM, Thomas Lauer <thomas.lauer@virgin.net> wrote:
>> If *IT* is really just a matter of taste, *IT* should probably not be
>> implemented.
>
> Well, that argument cuts in other ways. 'function fun(x) .. end' is
> just sugar for 'fun = function(x) ... end', it isn't strictly
> necessary.

But wouldn't it feel inconsistent to have a shorthand for
function(x) return x*x end
but not for
function(x) if x>0 then return 1 else return 0 end end

When you write a program and half the anonymous functions look like |x|
x*x and the other utterly differently?

Wouldn't maintaining that elegance require that you get expression
shorthands for most control structures in use for "short functions"?

-- 
David Kastrup