Seriously? Did they ask for this? Did they think this was an issue?
Because if it's the talk I think it is (from the list at the LuaConf
website, the Lua stored procedure talk by Alex Scotti), then it sounds like
they were happy with Lua and modified it ("We extended the data types to
include all DB data types and added some extensions to declare variables
with types, allowing for a form of strong typing at runtime") to suite their
needs.
*THIS* comes across as "this would be nice to have" to me. It's not
*YOUR* problem nor *YOUR* code. It's nice to want to help, but I think you
would be better served by *implemeting* your idea, making it a patch that
people can try out (maybe even the DB guys) and discuss (do the DB guys
think this would help them?).
Okay, getting back to yet another point:
Lua/VM versions without too much trouble, as most other extensions could
be trivially implemented through preprocessing (by replacing `load`)
(e.g. turning `x := (expr)`, the syntax for type-converting assignment,
into `x = typeconv(x, (expr))`). The only reason this __key thing can't
be done in preprocessing is because it would involve turning every
single `t[x]` into `t[tokey(x)]` which is (in theory) significantly
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
slower than just checking for __key in the VM.
^^^^^^^^
You don't know for sure. In my opinion, there will probably be no
significant difference between
t[tokey(x)]
and
t[x] -- with __key metamethod override
since they are both doing the same work. But I'm not 100% certain of that
because there's nothing to measure. I could also see the __key method being
measurably slower because of the overhead of checking the metatable; whereas
with the explicit call, you only invoke the overhead on items that need
translating. But again, I'm not 100% certain of that beacause there's
nothing to measure.