On 04/06/2012 15:28, mango wrote:
> Getting "all the keys" of a dictionary is rather problematic.
Indeed, that's the real problem here. Tcl simply doesn't know that a
value is *meant* to be a dictionary, it just knows whether it has been
accessed as a dictionary before (in which case it can skip re-parsing it
the next time). It also doesn't know anything about the identity of
values; stuff gets shared quite promiscuously, but also duplicated and
converted and generally munged around as necessary. You're not meant to
care too much about the details of that. (With 8.6, you can use
[tcl::unsupported::representation] to poke under the covers but that's
really just a debugging tool that exposes info that you ought to ignore.)
If you know externally that you have a 3-level dictionary (or some other
structure) it's trivial to enumerate the leaf key paths. That's the real
Tcl way.
Donal.