[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Interning strings considered harmful (somewhat)
- From: "Matthew P. Del Buono" <delbu9c1@...>
- Date: Wed, 4 Nov 2009 15:45:10 -0500
David Kastrup wrote:
> One can't use Lua's string operations (in particular pattern matching)
> on userdata, and there is no actual necessity to intern them for most
> applications (excepting indexing or fast equality tests).
One also can't rely on Lua's string operations to work on strings unless
they are interned in certain situations. Accordingly, it follows that
the userdata would expose a method through its __index metamethod that
would allow you to intern a string and produce a true Lua string. This
would require more work on the Lua side, but zero work on the VM side.
It would also allow you to explicitly control how an uninterned string
becomes interned, so you know precisely where your vulnerabilities lie.
Matthew P. Del Buono