lua-users home
lua-l archive

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

"Vijay Aswadhati" <> writes:

> On Thursday, July 12, 2007 12:57 AM, David Kastrup wrote:
>> I'd still very much prefer a Lua variant which defaults to
>> uninterned strings _until_ one uses them for indexing.  But it
>> still beats using TeX for string manipulation.  
> Count my vote as well, perhaps for Lua 6.0? In Ruby strings are
> mutable. Ruby introduces a new type called 'symbol' that are
> interned and used for indexing and comparison [1]. I think such a
> scheme would resolve a couple of issues (at least for me); for
> example I could then use Lua string for mutable binary data buffers
> instead of having to create a new user data.
> While we are off topic, let me also include my wish for an integer
> number type. I hate to maintain special builds of Lua.

I actually don't see much of a point with that.  Integers convert into
floats fast, and Lua being an interpreted language not being able to
make use of register scheduling and other compilation tactiques,
performance impact on modern architectures is negligible.

While conceptually integers and floats may be less similar than
interned and non-interned strings, there is no significant performance
advantage gained from letting this difference into the language, with
the single difference from converting large amounts of data structures
repeatedly and tentatively that might not get processed by Lua at all.

What might be more interesting for this kind of enterprise is a
non-opaque structured user type.  Supporting more diverse basic data
types in such structures might make the need for them inside of Lua
itself less compelling.

David Kastrup