lua-users home
lua-l archive

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

In-Reply-To: <>
X-Organization: Home
User-Agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.10) POPstar/2.05
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

In message <> you wrote:

> > My Fusion package will have a Javascript String object which will make
> > strings look like Unicode sequences and will support character indexing
> > as well as things like split, join and substring.
> Um. While a reasonable String class would be valuable, I'm not filled with 
> confidence with the idea of one based on the Javascript libraries; see the 
> archives for my opinions of the Javascript library system in general. 
> Although I'll admit that String isn't too bad; it's Array that's really 
> unspeakable. But this is a rant for another time.

None of the correspondents on this topic have pointed out that Lua
strings are not the same as strings in C, Javascript, Basic, ....
Their semantics are quite different, and it is perhaps unfortunate
that the use of the word "string" creates so many false expectations.
Lua strings are read-only. They are not mutable. A notation like x[2]
gets people thinking of an Lvalue - something updatable, so it is
not an appropriate notation IMHO.
 The fact that strings in Lua are not updatable means that you have
to use quite different algorithms for efficient string handling in Lua
from those one would use for C. Even Scheme is not a good source of
experience for understanding Lua strings. Experience with Haskell or ML
would be a better introduction, as I see it.

Gavin Wraith (
Home page: