[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Syntactic Sugar for function??
- From: "nikdo79" <dominik-wagner@...>
- Date: Tue, 26 Mar 2002 12:57:44 -0000
--- In lua-l@y..., Roberto Ierusalimschy <roberto@i...> wrote:
> > What's the Problem? A Bug? Or even intenion?
>
> Neither. It is a syntactic ambiguity. You can write
>
> f(a,b,c).x = function (x,y,z) ... end
>
> However, if you write
>
> function f(a,b,c).x(x,y,z) ... end
>
> the parser cannot tell that "(a,b,c)" is not the formal parameter list
> (well, it could when it sees the dot, but then it is too late). So, the
> form "function var (...) ... end" must have some restrictions.
ok, i get this. but function var[anothervar] () would not at all be ambigous, evenm var[myfunc(a,b,c)] wouldn't be.
> In Lua 4.0, "var" can be only a name, name.name, or name:name. In 4.1',
> this has been extended to name.name... But "var[exp]" is not accepted.
so i suggest for a more complete syntactic sugar this to be allowed.
dom