lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Mike Pall <mikelu-0802@mike.de> wrote:

> Roberto Ierusalimschy wrote:
>
> > - tables and strings respect __len metamethod
> 
> This makes sense for tables, sure.
> 
> But I'm strictly against __len for strings. This has a negative
> impact on software composability.
>
> ...

Your arguments are certainly valid but they don't sit easy with Lua's
general extensibility. Much of Lua's appeal and power stems from meta
constructs. Like all powerful tools these can be used and abused. If
someone wants to shoot himself (or others) in the foot there are already
methods aplenty in Lua.

IMHO sealing off doors for good is not always preferable to opening them
with, yes, the possibility that someone does indeed misuse them.

__len for strings, with the latter having a global metatable, may well
be one of these corner cases...

-- 
cheers  thomasl

web: http://thomaslauer.com/start