lua-users home
lua-l archive

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


On Fri, Jan 3, 2014 at 4:35 PM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> I hate to bring this subject back up after it sparked so much debate in the
> past, but I wonder if this limit could be increased to, say, 64 or 128
> bytes? In my C libraries' __index and __newindex methods I avoid doing a
> lot of strcmp()s to compare the key to each valid field name, by storing
> all valid field names in a table in the registry. String interning means
> that instead of using strcmp() to check the key I can just use a standard
> equality test. But that will fail if I have a field with a more than
> 40-character name (not unimaginable) and Lua doesn't intern the string,
> meaning the pointer I get as my key isn't the same as the string I stored
> in the registry.

For me, a field name with 40 characters is as unimaginable as one
with 64.  (Once you lose your mind, there is no limit on what you can
think... :)

-- Roberto


I feel like 40 is pushing it, but it could happen in some rare situations, where as 64 or especially 128 is a pretty good place to say "you're doing it wrong". But any limit is going to seem arbitrary to someone, so I guess it's just a matter of preference.

--
Sent from my Game Boy.