lua-users home
lua-l archive

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


On Mon, Aug 25, 2014 at 3:07 PM, Robert Virding <rvirding@gmail.com> wrote:
> Got into this discussion late.
>
> If you have pooling of strings how can you safely use them for dynamic data,
> for example from input, if you want the system to survive for any length of
> time? Or have I misunderstood what is meant by pooling?

Hmm, please elaborate :>  We've been talking about pooled strings in
the sense that once a string is created -- it does not change.  Not
only that, but it is checked for equality against the existing strings
Lua has already "seen"/interned.  When a string is created a hash is
computed based on the contents of that string.  So when you compare
'cat' == 'dog' Lua is internally doing a comparison of the hash of
"cat" to the hash of "dog" -- but it also may be as simple as a
pointer comparison.  (I don't know for sure in every instance)