[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua strings as "atoms"???
- From: Rici Lake <lua@...>
- Date: Tue, 17 May 2005 09:01:04 -0500
On 17-May-05, at 7:08 AM, Mike Pall wrote:
Mutable strings (plain buffers or buffer lists/trees) may be a better
solution. However this must be a core data type: you need a C API
to access the raw buffer and not just a __tostring metamethod.
Otherwise you loose all advantages since every C function needs to
convert them to/from immutable strings (which is exactly what we
want to avoid). And indexing tables is tricky, too.
That's a completely different issue. However, it's also interesting.
It would indeed have to be a core datatype, and you would therefore
need both a C API and Lua operators in order to gain the benefit.
I think that you should not expect that a stringbuffer would be
equal to a string with the same characters from the point of
view of table indexing; a mutable object needs to be keyed by
object equality, not by value equality. That would probably be
too confusing for normal use.
Actually, I'd probably implement a stringbuffer as a generalization
of file objects, rather than as pseudostrings.
- References:
- C api changing values, mark joselli
- Re: C api changing values, Asko Kauppi
- Lua strings as "atoms"???, Chris Marrin
- Re: Lua strings as "atoms"???, Ben Sunshine-Hill
- Re: Lua strings as "atoms"???, Chris Marrin
- Re: Lua strings as "atoms"???, Rici Lake
- Re: Lua strings as "atoms"???, Chris Marrin
- Re: Lua strings as "atoms"???, Rici Lake
- Re: Lua strings as "atoms"???, Chris Marrin
- Re: Lua strings as "atoms"???, Rici Lake
- Re: Lua strings as "atoms"???, Mike Pall