[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Table dot number?
- From: Axel Kittenberger <axkibe@...>
- Date: Fri, 21 Oct 2011 11:47:10 +0200
One can argue for minimalism of the parser or "because its the way the
parser is written". Or would we really gain for allowing it? But From
a point of grammar it is unambiguous. Any token beginning with a 0-9
is always a number, and never an identifier or string. There isn't a
good reason why it should be different after a '.'.
Really I started 3 times to write an answer to KR, why this obviously
wrong, but discovered my reasoning would be flawed. Then I came to the
conclusion, actually he has a point.
On Fri, Oct 21, 2011 at 11:30 AM, Patrick Rapin <email@example.com> wrote:
>>> Because it's ambiguous?
>> Actually it isn't.
> >From the language grammar point of view, it is ambiguous.
> But from the programmer point of view, it is.
> I think most people would expect t.1 == t, but the parser would
> assume t.1 == t["1"].
> The dot syntax is a syntax sugar to have named fields in a table.
> And I can't find a real world situation were t.1 (meaning t["1"])
> could be useful. You can still use t.f1, t._1, ... if you want.