[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why not allow local s = "abc":reverse()
- From: duck <duck@...>
- Date: Thu, 11 Dec 2008 21:35:00 +1100 (EST)
I assume it is because, before Lua 5.1, there was no metatable for string
This means that the method syntax couldn't be used with string objects
(only with tables and with userdata).
This means that there was never any need for the parser to deal with
So it didn't, and it still doesn't.
Since the notation
is pretty clear anyway -- and can even be said to be clearer in the case
that "the string has spaces" -- then...
...IMO it's not very important to change the parser, though it might be
nice in a future non-minor update, just for the sake of completeness.
The only times I find myself particularly keen to use a method call with a
literal string is when using the string.format() function, but since that
sort of use doesn't feel like applying a method to an object anyway, I'm
happy to add the (brackets) or simplpy to write string.format()