Overview
| Artifact ID: | 98bda24c71d61848caefe8a50c027556e688ee14 |
|---|---|
| Ticket: | bb6108bb671bb697f10466325e4e9c612831b544
Array tracing not as documented |
| User & Date: | dkf on 2016-08-20 16:22:15 |
Changes
- closedate changed to: "2457621.18212604"
- closer changed to: "dkf"
- icomment:
There's a fairly complex set of internal states, but arrays exist independently of their contents. Furthermore, it's possible for a variable to exist but be reported (e.g., by <code>info exists</code>) as not existing; that typically means that either there's a trace keeping the storage alive or that there's an <code>upvar</code>-link pointing to it. It'll get reaped once there's no more references to it on the C side, or it'll have something put into it and become persistent (until it is deleted or has its owning context destroyed). However, once you start using multiple array-level traces that modify the array on read, my ability to figure out sanity gets strained. Traces never run while they are already running, but one trace can cause another to run. Moreover, <code>array get</code> triggers traces in two phases, once to allow the set of keys to be correct (used to make <code>::env</code> work right) and again when the individual elements are read (and failures to read the variable there cause the key to be omitted from the result). It doesn't detect keys added while it is running since that might well cause all sorts of flapping. It's probably not a good idea to put a reading-trace on an array when there's another reading trace that does a read on the array. In fact, don't do that. Do consider using <code>trace add variable y array</code> as well for setting the <code>foo</code> element. That runs at a time <i>before</i> the list of keys is constructed. I won't fix anything here. What we've got is probably as good as is practical.
- login: "dkf"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Wont Fix"
- status changed to: "Closed"
- username: "dkf"