lua-users home
lua-l archive

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



I like the open attitude with which you write, coming from the Python world.. :)

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.

-ak


13.9.2004 kello 22:09, Philippe Fremy kirjoitti:


	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