1.4 Pict Findable and Replaceable Identity
Every predefined pict constructor or update method creates a pict that has a fresh identity for the purpose of to find or replace a pict p within another pict q when q is constructed from p (as introduced in Static Picts). The == operation on picts does not compare picts by this identity. Use Pict.identity to extract a pict’s identity as used for finding it in another pict. The findable children of a pict, as reported by the Pict.children property, are the immediate picts of q that were used to construct it, and recurring through Pict.children properties from q reaches all findable picts used to construct q.
Sometimes, it’s useful to suppress the identity of a pict and all of the picts used to build that one. The Pict.launder operation on a pict produces one that draws the same and has the same bounding box, but has a fresh identity and that hides the identity of all picts used to construct it, so Find and similar functions cannot find them. The Pict.children property of the result of Pict.launder is an empty list.
Like a pict’s width and height, it’s findable location within another pict is technically a property of a static pict. A snapshot (via Pict.snapshot) of a pict by default has an identity that is the same as the original pict. Consequently, it is possible and convenient to find the location of (a snapshot of) an animated pict within the snapshot of another animated pict. In the same way that Pict.width on an animated pict produces a result matching a snapshot of the pict at the start of its time box, finding an animated pict within another animated more precisely returns the location of a snapshot within a snapshot.
Potentially distinct from the findable children of a pict are its replaceable dependencies, which are picts that can be discovered and replaced with Pict.rebuild or Pict.replace. Normally, the findable children and replaceable dependencies of a pict are the same, both determined by the pict’s construction. The rebuildable function creates a pict with only the listed dependencies, however, while the result of a rebuild function supplied to rebuildable determines its findable children. Similarly, animate creates an animated pict p with declared dependencies, and findable children corresponds to a snapshot. Note that the findable children of a rebuildable instance or animate snapshot can vary over time or configuration; for example, an animate snapshot might include some of its dependencies only at certain times, and a rebuildable configuration might chose one or the other of its dependencies based on some comparison of the dependencies; declaring dependencies explicitly makes replacement consistent.
Similar to the way that Pict.snapshot produces a pict with the same findable and replaceable identity as the snapshotted pict, a rebuilt pict via Pict.rebuild similarly gets an identity matching the original pict. This rule also allows the rebuilt version of some pict p to be found within a rebuilt version of q in the case that a dependency of p is updated to produce the rebuilt q. Also, in that case, the Pict.find_rebuilt method of the rebuilt q finds and returns the rebuilt pict that replaced p.