[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: metatables for strings?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 6 May 2015 13:13:59 -0300
> >> PS. I still like syntax "hello":sub(1, 4)
> I always wondered: is there a reason why this syntax is not supported?
Because to allow it in general would require unbounded lookahead.
Consider for instance:
"x".."x".."x".."x".."x".."x".."x".."x".."x".."x".."x":sub(1, 4)
The current solution with parentheses solves this and is fully general.
It's probaly easy to allow just this syntax <string literal> : <function call>,
but not general enough.
- 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