[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Syntactic sugar for function parameters
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Thu, 8 Feb 2007 10:46:56 -0500
Robert Raschke wrote:
> > dropping () for function calls cannot work:
> >
> > myprint = print
> >
>
> I think it was meant as in "if there's no parens after the
> function take the next thing as the sole argument", like:
>
> a_string = "foobar"
> print a_string
>
> or
>
> twice = function (x) return function(y) return x(x(y)) end
> end double = function (x) return x + x end print (twice double 42)
Maybe it's time to introduce a space operator. That way the expression:
print a_string
would turn into a call to some metamethod:
function __space(a, b)
return a(b)
end
Maybe not :-)