[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua design : why no lists ?
- From: Asko Kauppi <asko.kauppi@...>
- Date: Tue, 14 Sep 2004 19:43:17 +0300
I like the open attitude with which you write, coming from the Python
To cover the tuple issue first, yes, that has been discussed -quite
intensively in fact- recently on this list. No clear solution, yet,
there are pros and cons. I guess we're just waiting, what will be in
5.1, am I right?
On dedicated lists, my first reaction was "why"? This may be an issue
where you have to delearn something. Personally, I couldn't come up
with a single case where I'd needed lists with Lua. And even if I did,
a case where the runtime cost would have called for optimization.
There are, as you know, 'table.insert' and 'table.remove'. These can
be used either as a stack or as a list. You can close your eyes from
the fact that they're really tables. Or rename to 'list.insert' and
'list.remove' if you like? :P
If you have a good case, could you share that with us? Something,
where having a dedicated list object would really boost the performance
of the application? As Aaron pointed out, you'd be able to easily
build your own mechanics using the building blocks of Lua. I would not,
however, start making a list type.
13.9.2004 kello 22:09, Philippe Fremy kirjoitti:
I am quite new to lua but I have a python background. I think lua is
because it is _very_ easy to embed, and is quite a powerful language,
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
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
table to make it emulate list behaviour not very elegant, for something
The second thing which surprise me is the pack/unpack thing. In lua,
have no object to represent the (1,2). You can pack them and unpack
but it is difficult to get a hand on them. When a function return
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
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
implement list in lua, would it be rejected ?
An open source OS for contactless Smart Cards
http://www.jayacard.org - Jayacard