Why not just use a hash and ditch the array then?
Matt
Leopold Toetsch wrote:
The current implementation of find_lex (by_name) is suboptimal. A linear scan over the list of lexical names is performed
(s. sub.c:lexicals_get_position()).
A better way would be to provide a list of lexicals plus a name hash, where hash values are indices into the list.
As such a functionality might be handy is a general PMC class, I think, best is to generate a new class named ArrayHash or SortedHash or such.
Proposed Synopsis:
set P0["key"], value list_push(value); hash_put(key => list.elements-1)
set P0["key"; idx], value list[idx] = value; hash_put(key => idx)
set value, P0["key"] # retrieve by key set value, P0[idx] # or by index
Comments welcome, leo