[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Coroutine support in 4.1 / IPC mechanisms
- From: Edgar Toernig <froese@...>
- Date: Fri, 20 Apr 2001 02:48:52 +0200
Luiz Henrique de Figueiredo wrote:
>
> - more general syntax for function definition and expressions:
> function a.b.c.d.e.f (...) end
> (a)=3; (print or write)(9)
How is that going to work? Will the ; be required in Lua 4.1?
Sol allows these kind of things too. But the requirement still is,
the a statements begins either with a keyword or an identifier.
So this is valid
a,(b or c).x,d = 1,2,3
but this is not
(a or b).c = 1
because of the leading '('. It could be misinterpreted i.e.
f(1)
(a or b).c = 1
--> f(1)(a or b).c = 1
that is call f(1), returns a function, call this with (a or b),
returns a table and assign to member c of it.
So the limitation "a statement _must_ begin with a keyword or
an identifier (or upvalue)" is still there. How are you going
to solve this?
Btw, in Sol the parenthesized expressions have the additional side
effect that they generate an r-value (with one result).
So this is _not_ valid:
a,(b),c = 1,2,3
And here it may be useful:
f(a, b, (g(1)))
which will _always_ pass 3 args to f because the () around the g call
will generate a single r-value.
Ciao, ET.
PS: Btw, these changes makes the parser even smaller ;-)