[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: strings
- From: Alexander Gladysh <agladysh@...>
- Date: Wed, 16 Dec 2009 18:45:08 +0300
On Wed, Dec 16, 2009 at 18:34, Mark Hamburg <mark@grubmah.com> wrote:
> This thread is an argument for why colon deserves first class treatment of some form.
> We want the contents of the string namespace as methods on string, but they make no sense to be accessed as index operations.
mystring[3] is a very common gotcha for Lua newbies.
However I'm not sure it may be used as an excuse for low-level language changes.
I'm for a metatable on string module's table — to catch __index and
__newindex access and fail with meaningful runtime error.
This is cheap and, unless I'm missing something, should solve the problem.
Alexander.