[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: [PROPOSAL] a new function: table.proto()
- From: Benoit Germain <bgermain@...>
- Date: Tue, 4 May 2010 18:32:47 +0200
> -----Message d'origine-----
> De : lua-bounces@bazar2.conectiva.com.br [mailto:lua-
> bounces@bazar2.conectiva.com.br] De la part de Javier Guerra Giraldez
>
> no. in fact, having the array part is quite handy to store a desired
> order on a hashtable (which is intrinsically unsorted). see how
> luaExpat reports XML argument lists
>
To be fair, I suppose that a table implementation without the array part optimization could in fact be able to store a sorted sequence of scalar keys if the hash function yields sorted hashes for scalar keys (which is to say the scalars themselves). Thus, to have sorted tables, one has to choose between the array part and an ordered hash function on scalar keys. So yes, it *is* an implementation detail after all.