[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: metatables for strings?
- From: Andrew Starks <andrew.starks@...>
- Date: Wed, 6 May 2015 20:05:36 -0500
On Wednesday, May 6, 2015, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> I always wondered: is there a reason why this syntax is not supported?
> (Other than vacuously-true answers such as "it wasn't implemented that
> way" or "because the grammar disallows it")
>
> In other words, does disallowing it prevent a bad grammar ambiguity,
> or something like that?
It prevents a grammar ambiguity (whether it is "bad" is up to taste):
The code
a = b "xy":foo()
could be
a = b; "xy":foo()
or
a = b"xy":foo()
The same already happens with parentheses, but that would create yet
another ambiguity.
-- Roberto
Thank you for this explanation.
-Andrew
- References:
- metatables for strings?, Sam Putman
- Re: metatables for strings?, Nagaev Boris
- Re: metatables for strings?, Sam Putman
- Re: metatables for strings?, Sam Putman
- Re: metatables for strings?, Dirk Laurie
- Re: metatables for strings?, Nagaev Boris
- Re: metatables for strings?, Sam Putman
- Re: metatables for strings?, Nagaev Boris
- Re: metatables for strings?, Dirk Laurie
- Re: metatables for strings?, Hisham
- Re: metatables for strings?, Roberto Ierusalimschy