lua-users home
lua-l archive

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


> -----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.