lua-users home
lua-l archive

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


On Fri, Mar 23, 2012 at 8:28 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> Anyway, there are tons of places an internal stringbuffer improves
>> performance, serial concations is just one example, and as I realize
>> this experimental feature 5.2.1-work is about  would also been covered
>> as just one special case of that. So for example reading large String
>> from a file, it could be stored as "Stringbuffer" until first used in
>> a String context (e.g. as key to a table, compared to another string
>> etc.)
>
> We thought about something similar. Specifically, the current
> luaL_Buffer mechanism would be implemented on top of that.
>

I'm beginning to think I'd love to have second type of strings in Lua:
mutable strings
(yeah, sometimes I'm crazy about efficiency).
There's grave accent (`) still unused in Lua syntax, so the constructor would be
`mutable_string` in Lua and char *lua_newmstring (lua_State *L, size_t
size) in C.
`a`*5 would give `aaaaa` and so on.
Both string types would be interoperable.
'mstring' module would implement similar operation set as 'string' module.

Is that too mad?
Is there any space left for additional data type in Lua VM anyway?