|
As for weak values, your implementation there in luapower doesn't have
a __gc metamethod on tuples, which makes the use of weak values not
even worth the overhead it does add -- you aren't saving that much
memory since the index tables are be populated.
In other words, there's a lot of different ways to do it, each with
advantages and disadvantages, and implementing any of these in the Lua
core would have similar tradeoffs and I'm fairly certain that you're
not going to satisfy everyone by choosing ONE of these to canonize in
the core.
In particular, the most obvious implementation in the core
is the non-interned hashed version, and I think people would complain
vehemently about making table reads more expensive.
These are, of course,
exactly the same tradeoffs you have to make doing it outside of the
core.