[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Allow table.keyword rather than table['keyword']?
- From: Karel Tuma <kat@...>
- Date: Mon, 14 Mar 2016 06:36:55 +0100
Excerpts from Jonathan Goble's message of 2016-03-14 06:13:11 +0100:
> On Mon, Mar 14, 2016 at 12:57 AM, Xpol Wan <xpolife@gmail.com> wrote:
> > Is it possiable in future Lua version to allow table.keyword like
> > `promise:then()` .
>
> Unless I'm missing something, this wouldn't result in any ambiguous
> syntax. An identifier, followed by a . or :, followed by a keyword, is
> never valid syntax under current rules, so treating the keyword in
> that sequence of tokens as an identifier shouldn't cause problems.
It would slightly complicate the lexer/parser relationship - lexer
currently does not take into account current parser state. As for
ambiguity, things like accidentaly placed dot would not be detected
as syntax error anymore in some cases.
Personally, I just use capital letter to avoid collision with keywords.