lua-users home
lua-l archive

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

Norman Ramsey wrote:
 > 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 :-)

His total lack of response to my mentioning table.concat is quite worrying, as is the tone of his last posting, which is pretty amazing. It's not like it's the first time people have posted string buffers to the list. Perhaps he is supremely confident in his p.o.v. and abilities, like that, um, Hans fellow. The discussion, the effort of those who replied, seemed pretty futile on our part.

Sounded as though he has not absorbed Lua idioms, and is fighting the language. I'm afraid the people he's advising won't be getting a dose of proper Lua culture. Pity.

Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia