[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: can be done (anonymous lookups)
- From: Jamie Webb <j@...>
- Date: Tue, 3 Aug 2004 00:16:19 +0100
On Tue, Aug 03, 2004 at 01:34:08AM +0300, Asko Kauppi wrote:
>
> I was trying around and noticed this can be done:
>
> return ({ [0]="yes", [1]="no" })[ rc ]
>
> ..but this not (had tried before):
>
> return { [0]="yes", [1]="no" }[ rc ]
>
> Is there a syntactical reason, or is it just an implementation detail?
You're aware of the kludge that prevents you putting a newline before
the ( when calling a function? Allows table constructors to be
prefixexps would have exactly the same problem, e.g:
-- One statement or two?
x = f
{ ... }[i]()
Except it's more likely that you'd want a newline there, e.g.
some_configuration_directive
{
...
}
-- Jamie Webb