lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

>IMHO, if a.b is just a syntatic sugar for a["b"] it must work exactly the
>same way.

Not quite true. How about a["1"]? Should it be equivalent to a.1? This will
clearly pose problems for those strings that cannot be valid identifiers
(considering Lua's grammar).

As a side note, the project we are using Lua in will provide the migration
from a house-brewed scripting language to Lua. As our original language
caters to people in the electrical engineering field, it permits identifiers
such as J1.1 where J1 is a connector name and 1 is the pin number. Obviously
such constructs cannot be implemented in Lua if it is to keep its current

We resorted to using a preprocessing step that internally converts such
constructs to proper Lua syntax.

Marius Gheorghe
CableTest Systems Inc.
Cable testing specialists.

-----Original Message-----
From: Grisha []
Sent: Tuesday, November 25, 2003 11:54 AM
To: Lua list
Subject: Re: Reserved keywords

Not quite true. These languages don't have such 'syntatic sugar' things.
IMHO, if a.b is just a syntatic sugar for a["b"] it must work exactly the
same way.

with respect,

----- Original Message -----
From: "Roberto Ierusalimschy" <>
To: "Lua list" <>
Sent: Tuesday, November 25, 2003 7:58 PM
Subject: Re: Reserved keywords

> > Is it really necessary that the parser complains about the use
> > of reserved keywords  in case of foo.<keyword> or
> > foo:<keyword> type syntax?
> I wouldn't say that it is "really necessary", but it is how it works in
> virtually all languages that have reserved words (C, C++, Java, Pascal,
> Ada, etc.)
> -- Roberto