[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Table constructors
- From: David Jeske <jeske@...>
- Date: Mon, 30 Aug 1999 09:48:16 -0700
On Mon, Aug 30, 1999 at 09:32:25AM -0300, Tomas Guisasola Gorham wrote:
> > t = { 42, name = "bob", 45, color = "blue" }
> >
> > and would be equivalent to:
> >
> > t = { 42, 45 }
> > t.name = "bob"
> > t.color = "blue"
> >
> At first, I thought you'll propose equivalence to:
>
> t = { [1] = 42, name = "bob", [3] = 45, color = "blue" }
I don't think anyone has ever asked for this. I think when this
discussion comes up, it's always for equivilance with:
t = { [1] = 42, name = "bob", [2] = 45, color = "blue" }
As I've mentioned in the past, I only wanted the freedom to put the
numeric values at the beginning _or_ the end. I don't know if the
current Lua can do this, I think someone said it would be able to. For
example:
t = { 42, 52 ; name = "bob", color = "blue" }
t = { name = "bob", color = "blue" ; 42, 52 } -- either one works
> Well I think it can make some confusion. And if you type
> something wrong, like
>
> t = { 42, name , "bob", 45, color = "blue" }
This is not valid syntax unless "name" exists in the current global
context as a symbol. Which admittedly could occur and cause confusion,
but even without any comma-separated list of numbers, replacing an "="
with a "," is going to yeild different behavior, and so it seems like
a weak reason to avoid changing it.
--
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net