lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo wrote:
> 
> >From: Stephan Herrmann <stephan@cs.tu-berlin.de>
> >
> >I'm the only one who needs this predictable ordering?
> 
> Surely not. But I don't see a way out.
> Perhaps you can give more examples of why this would be useful and how this
> could be implemented...

Ordered tables would be nice.  In MUMPS for example (terrible language but
cute arrays) all arrays are ordered.  And, arrays could be in-core or on-
disk.  They build complete databases with these (variable length key/data)
on-disk arrays.

They used b*trees for the on-disk arrays.  Don't know about the in-core
ones, I would guess either standard binary trees or even b*trees too to
get a simple memory management.

Putting ordered tables into Lua would cost a lot.  Good bye performance.
But, you could implement them as userdata.  There's just one pitfall:
You have to create references to the elements.  And that's memory
consuming and slow.  But if Lua were able to walk these userdata-tables
during the gc-phase (ie gc-mark tagmethod) ...  *hinthint*g*

Ciao, ET.