[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua design : why no lists ?
- From: Philippe Fremy <phil@...>
- Date: Mon, 13 Sep 2004 21:09:39 +0200
Hi,
I am quite new to lua but I have a python background. I think lua is great
because it is _very_ easy to embed, and is quite a powerful language, by
its simplicity. I love that class as table thing for example.
However, there are two things that I find strange:
1. the absence of list
2. the pack/unpack thing
The absence of list surprise me. A list is quite a common need and
implementing the current list on top of tables is not as convenient and as
simple as a real list. A list is quite simple, and I believe, easier to
optimise than a full table. Why not provide one ? I find the hacks around
table to make it emulate list behaviour not very elegant, for something
that common.
The second thing which surprise me is the pack/unpack thing. In lua, you
have no object to represent the (1,2). You can pack them and unpack them
but it is difficult to get a hand on them. When a function return a,b,c ,
you can either store each of them but maniuplating the result without
storing a,b,c into 3 variables is not very practicle. You need to
pack/unpack them before doing anything. I find this quite suprising given
the simplicity and the power of the rest of the language.
I like the two together. With a proper list implementation, it would be
easier to manipulate packed data.
I am curious about the design decision behind this. If somebody where to
implement list in lua, would it be rejected ?
regards,
Philippe
--
An open source OS for contactless Smart Cards
http://www.jayacard.org - Jayacard