lua-users home
lua-l archive

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

Eric Tetz wrote:
Roberto Ierusalimschy wrote:

- there are several other small changes

What I've found (by comparing _G in 5.0 vs 5.1):


     New name for LUA_PATH (now deprecated) used by 'require'

  string.reverse (s)
    returns a reversed copy of string 's'

This one is very strange...
Can somebody give me a real-world use case where this function is so useful that it needs to go in a standard library? I can't think any practical use myself. Perhaps it is a temporary test function?

I would rather see a string buffer library added to the standard library. One that would allow building large strings without hashing and perhaps GC overhead, allowing direct read/write of bytes in arbitrary addresses within the string size, automatic growth of buffer (or not), etc.

Unless somebody really convinces me that the table approach is almost as memory efficient and hashing can't be avoided anyway because Lua does it on every string it sees...

(If I do:
x = string.sub(largeStr, i, j)
x = nil
does x is being hashed?)

I dream of such library for quite a long time (since Roberto did his LTN about string concatenation efficiency) and discovered later that it exists in Java (and probably on a number of other languages with high level string processing).

I would write it myself, but never got time to start it...
So would it be useful at all?

Philippe Lhoste
--  (near) Paris -- France
--  Professional programmer and amateur artist
--  --  --  --  --  --  --  --  --  --  --  --