[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Holes
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 14 Dec 2010 12:03:44 +0200
On Tue, Dec 14, 2010 at 10:34 AM, Dirk Laurie <dpl@sun.ac.za> wrote:
> Sorry, I stop reading the post right here. A language that
> has only 8 value types can't afford to add a type simply to
> address a minor inconvenience.
I think this elegance argument carries a lot of weight with the Lua
authors, which is why it's probably a non-starter.
In any case, we're expecting a single very flexible data type to work
how we mean, and the solution is to create a more special purpose ADT.
E.g., an array. Option to create with a given length, with optional
initial values. Indexing with non-numerical key is an _error_, as is
indexing out-of-bounds. Give it methods like append() and insert()
which preserve the invariants.
This can all be done easily with plain Lua, although a numerical
person might balk at the potential inefficiencies. But Pascal
programmers understood that it was more important to be correct than
fast, at least initially.
steve d.