> > That means that list's lindex accessor is O(1) and appends are O(1)
> > except where we need to increase the C Tcl_Obj **objv array (and that
> > only needs to copy the pointers).
>
> I'm happy to stand corrected regarding the implementation, but for someone
> writing Tcl code, is there a meaningful difference between my flawed
> conceptual model and the implementation?
Only that the conceptual model underestimates the power of lists.
There are cases where lists are avoided based on the flawed conceptual
model, but they would actually be good options. In 7.x, which was
pre-internal-objects Tcl, it was faster to create an array that was
indexed by "integer", like so:
set ary(1) a
...
set ary(n) z
and then access it with $ary($num), but this is now faster with lists
based on the internal object rep, although it all looks the same at
the Tcl level.
Tcl is very simple for people to learn, but when you want to start
squeezing the speed out of it, you do have to be more concerned about
what goes on under the covers (which is a lot). Thus, there is only
importance for the conceptual model when you want to extract the most
out of the language.
Jeff