lua-users home
lua-l archive

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


Strings are a native thing, since there are string literals in source code. I don't think anyone wants to string literals to go. That what makes them different to generic UserData. There is more to it due to automatic coercions and the '..' operator, but thats another story.

Mutables are bad. More mutables are worse. If I'd see a language develop, it be more in the directions of immutables in the direction of deeply frozen tables. Albeit it may seem counterintuitive at first, so many problems and issues go away if one would use immutables. For example the whole computation times of the # operator, vs. ipairs would go away in a poof.



On Fri, Aug 22, 2014 at 11:27 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
2014-08-22 10:21 GMT+02:00 Coroutines <coroutines@gmail.com>:

> Anyway, this whole thing has me thinking that I wish "strings"
> did not exist in Lua.  It's really just userdata and sometimes
> I wish Lua didn't pool strings.

Except that userdata is advanced, whereas strings are very,
very basic indeed, there are languages like SNOBOL that have
nothing but.

Think of pooling strings as Lua's way of dispensing with the
need to write "const" zillions of times as in C++ (or even C, for
that matter). It gives me great comfort that I can write

   if line=="rather long string that appears only once"

without losing run-time efficiency.