[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: metatables for strings?
 
- From: Roberto Ierusalimschy <roberto@...>
 
- Date: Wed, 6 May 2015 20:09:42 -0300
 
> 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
- 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