An atom cannot contain atoms in a higher namespace, but it can reach them and access their values. Reaching takes place when atom explicitly refers to a namespace before it in the universal order:
(m my-machine
(w some-world
(s this-stream
(v draft-view
(@p1 para one text)
(@p2 para two text))
(v second-draft
(@p1 different p1)
(@p2 (v draft-view (@p2))))))
This definition of (v second-draft)
has an atom (@p2)
is that is reaching for a namespace above it (v draft-view)
. The namespace abovethat, the stream (s this-stream)
, is searched for (v draft-view)
to retrieve the value of (@p2)
there.
Here is (v second-draft)
in 2-form
:
(v second-draft
(@p1 different p1)
(@p2 (v draft-view (@p2 para two text))))
A reaching expression cannot change values in the namespaces it reaches into, but it can be used to recreate the expression's environment from scratch. The 2-form version of (v second-draft)
cannot alter the value of an existing v draft-review)
or its (@p2)
, but an expression like this can be used to recreate the dependency environment if it does not exist already. If (v second-draft)
were imported into a new stream, for example, it could be used to build a (v draft-view (@p2 para two text))
in that stream.
Here's another example of reaching for data in a different world:
(m my-machine
(w work-projects
(v phone-list (@larry Larry Smith :cell 305-555-1212)))
(w personal-projects
(v contacts (@larry (w work-projects (v phone-list (@larry)))))))
And (w personal-projects) in 2-form:
(w personal-projects
(v contacts (@larry (w work-projects (v phone-list (@larry Larry Smith :cell 305-555-1212))))))
Reaching for data in another machine:
(m david
(v our-friend-the-atom (m nuclear-machine (s books (v our-friend-the-atom)))))
(v our-friend-the-atom)
in 2-form:
(v our-friend-the-atom (m nuclear-machine (s books (v our-friend-the-atom (@chapter1 …) (@chapter2 ...)))))
The entire (m david)
machine in 2-form:
(m david
(v our-friend-the-atom
(m nuclear-machine
(s books
(v our-friend-the atom (@chapter 1…) (@chapter 2…))))))
This expression could not be used to overwrite the (m nuclear-machine)
if it already exists, but it could be used to create one if it does not.
Every MSL expression must be complete within its containing expression. In other words, every expression in 1-form
must resolve immediately to2-form
in which no getters are required. It is an error to write or hold in memory an MSL expression which doesn't resolve fully to 2-form
. This is enforced by the viewing environment, which assists the user in resolving expressions as MSL code is moved between contexts.