[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Syntactic sugar for function parameters
- From: David KOENIG <karhudever@...>
- Date: Sun, 04 Feb 2007 14:40:13 -0800
Ivan-Assen Ivanov wrote:
> Hello,
>
> throughout our code we frequently use the following construct:
>
> foobar( function() ..... end )
>
> where the anonymous function body is often very small.
>
> Leaving cancer of the semicolon concerns aside, maybe this is just
> begging some form of syntactic sugar, similar to
>
> foobar "string" as an equivalent for foobar("string")
> or
> foobar { foo = "bar" } as an equivalent for foobar( { foo = "bar" } )
>
> What would you suggest as a possible syntax? It has to be
> implementable with token filters, and simple enough to fit with the
> overall syntax of the language.
> E.g.
>
> foobar function ... end ?
>
> Why do we need the empty () in normal Lua anyway? I guess they are
> needed to disambiguate in some situation, but I can't think of it...
>
> Best regards,
> Assen
>
func(...) is nice and clean...