[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: newbie question - strings and arrays
- From: Gavin Wraith <gavin@...>
- Date: Thu, 13 Oct 2005 16:19:26 +0100
User-Agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.10) POPstar/2.05
Content-Type: text/plain; charset=us-ascii
In message <firstname.lastname@example.org> you wrote:
> > 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
> 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
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
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 (email@example.com)
Home page: http://www.wra1th.plus.com/