lua-users home
lua-l archive

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

 > Basically, all programmers expect that a = a .. b should be efficient.

A programmer with a decent education should expect that in a language
with immutable strings, iterated concatenation is quadratic in the
length of the result.  A programmer without a decent education will
discover the quadratic behavior when it becomes important in practice.
(No blame attaches to programmers without decent educations, although
some blame might attach to their teachers.)

Your string extension looks entirely worthwhile, but it should be a
new type of userdata from which a Lua string can be extracted once the
concatenation is finished.   Unless, of course, somebody can match its
performance using table.concat :-)