|
Am 16.04.2014 08:17 schröbte steve donovan:
On Tue, Apr 15, 2014 at 9:51 PM, Tom N Harris <telliamed@whoopdedo.org> wrote:Or get rid of the metatable and tell everyone to use the `string` functions directly.Which would be a backwards step, IMHO. String methods are very convenient (although a _little_ slower than localized functions). In any case, the string table is global and people can patch it anyway - the metatable just has __index=string.
On the other hand the polymorphism is totally superfluous so far, because AFAIK no-one has implemented an additional string type for Lua yet (the UTF-8 strings use normal Lua strings as backend, so the shared metatable prevents you from providing specialized methods for them).
Paranoid people can always give strings a metatable which points to their own protected copy of string...
Hmm, interesting! I didn't think of that ... Now only the issue with sandboxing remains.
Philipp