next up previous contents index
Next: Reality Up: An Example Previous: Early Binding   Contents   Index


Visions

Multiple inheritance occurs so frequently in advanced applications of object oriented programming that the dreams package provides a special construct for dealing with it explicitly -- the vision. A vision is an ordered set of dreams. A thought may be seen in a vision the same way that a thought may be pondered in a dream. When a vision is activated, each of the dreams listed in the specification of the vision are activated in turn. The first dream specified has dominance and subsequently specified dreams have successively lesser influence over the understanding of the vision. When the vision is later deactivated, all the dreams are deactivated in reverse order. Complex factoring schemes, called inheritance networks, may be constructed by building a series of visions that share several dreams among themselves in different ways.

The next four lines of the example demonstrate the concept of visions. There are two visions, BAZ and BOK. They are both constructed from the same component dreams, but the dream ordering is different. When hmm is seen in BAZ, the definition of . in the understanding of BAR dominates, and the variables are displayed in the usual way, but when the same thought is seen in BOK, the definition imagined in the understanding of FOO dominates, and the variables are displayed with leading zeros and trailing carriage returns.

The next example demonstrates that a dream may be used as an argument to SEE in place of a vision. The effect is the same with respect to pondering the thought, only SEE incurs slightly more overhead than PONDER. When used this way, the dream is considered to be a vision with respect to lifting by DEJA-VU.

A nested vision, BACH, containing the dream FOO and the vision BAZ, is created and sent the thought hmm. Since FOO has precedence over BAZ, the imagined behavior of . predominates and the display of numbers appears with leading zeros and carriage returns.

Another nested vision is created with BACH as a component. The inheritance from BACH is overshadowed by the inheritance from FOO and COMA, but since COMA is the null vision, it will contribute nothing to the understanding of HANDEL. This demonstrates the ability of a vision to be composed of multiply nested dreams and visions.

Next, the vision MOZART is created from the dream BAR and the vision HANDEL. HANDEL inherits the leading zero behavior of . from FOO's understanding, but this is overshadowed by the higher priority inheritance from BAR, which understands . in the normal sense. The result is that the numbers display without leading zeros when hmm is seen in MOZART.


next up previous contents index
Next: Reality Up: An Example Previous: Early Binding   Contents   Index
Robert J. Brown
1999-09-26