Any value in MSL code can draw from another source. In addition to literal values supplied within the expression, there are two other sources for MSL values: other MSL expressions and bracketed transforms.
(@DONALD Donald Duck) (@DAISY Daisy Duck) (@DONALD :gf (@DAISY)) (@DAISY :bf (@DONALD)) ⇒ Donald Duck (@DAISY :bf) ⇒ Donald Duck (@DONALD Donny) (@DAISY :bf) ⇒ Donny (@DAISY :bf (@DONALD Leopold)) ⇒ Leopold (@DAISY Elizabeth Duck) (@DONALD :gf) ⇒ Elizabeth Duck (@DAISY) ⇒ (@DAISY Elizabeth Duck :bf (@DONALD Leopold)) ⇒ Elizabeth Duck
Any atom's values can be used to compose another atom's value in an expression. When an
embedded atom is encountered (an atom which serves as part of another atom value or metadata value), the MSL itself is stored in the value position.
An embedded atom's MSL is interpreted once when the embedded atom value is stored, and once again when it is retrieved.
An embedded atom which is a setter will set all its values when the embedded atom value is stored, and then again each time the embedded atom value is recalled.
An embedded atom which is a getter will get the curent value when it is stored. Later, it will get the then-current value each time it is recalled.
Circular references, such as two atoms referring to each other or a single atom referring to itself, are supported as long as the atoms' definitions are valid according to the normal left-to-right and inner-to-outer evaluation rules of MSL. In the previous example,
@DAISY can refer to each other as long as each is previously defined syntactically.
You can refer to an atom form (an atom, view, datatype, machine, etc.) far away as long as the expression returns a value that is valid for the containing expression. Immediate recasting to full form ensures this value is valid at the time the expression is run.
(@WALT (m david (w personal (s disney-book (c disney-people (@walter-elias-disney))))))
The resulting value, the value of
(@walter-elias-disney) inside the named canon inside the named stream, world, and machine, is applied to the new atom
(@WALT) in the current context. As long as all these other references resolve immediately, this expression is valid. It has already been recast as a setter which can be used to reconstruct the entire context in which it was called.
This short example assumes only a simple value for
(@WALT (m david (w personal (s disney-book (c disney-people (@walter-elias-disney Walter Elias Disney))))))
This expression alone can be used to construct the entire machine, or at least enough of it to process itself. If
(@WALT) does not exist in the current context, it can be created. The next parameter sets its value.
If a machine named
(m david) does not exist, it can be created. The next parameter sets its value.
If a world named
(w personal) does not exist, it can be created… and so on, down to the canonical atom
(@walter-elias-disney) which is created if it does not exist.
A second source for MSL is a file reference. This is provided through a bracketed transform function which supplies a value to the containing expression.
(s term-paper (c syllabus [file:///Users/… /term-paper/syllabus]))
This would retrieve the named file and supply it as the value to the
(c syllabus) canon. It would be an error if this file did not return a valid canon. The viewer is responsible for processing all transforms and must supply the engine with valid MSL to replace this URL reference. Typically, a viewer would translate the disk file to plain text or MSL if it is not already in one of those formats, then return the MSL text as the value in the expression. A :url metadata-key could be appended with the original URL before the MSL is submitted to an engine.
A third source for MSL is a URL. This is provided through the same transform function as files.
(s shakespeare-research (v romeo-and-juliet [http://archive.org/romeo-juliet]))
This would retrieve the file from the URL and supply it as the value of the named view. It would be an error if this URL did not return a view. Here again, this would be managed by the viewer. A plain text file is a valid view.
In its most basic form, an MSL program is a plain text file with MSL expressions executed in the order in which they appear. Any MSL text file which is processed by the engine has the effect of executing the expressions within in it in the context of the present state. In other words, any new text file of MSL introduced into the engine will create or modify the system state as necessary to reflect the information contained in the file's expressions.
A Mimix machine can start with an empty state only if no MSL text file is provided. Typically, a machine would be started with a start.msl file with MSL expressions that load the canonical data and views that are desired when starting the machine for the first time. A start.msl file could load all the streams required by a particular corporation, department, or university class.
In practice, an MSL text file can be encrypted when it is being stored and decrypted before use.
In practice, rewinding is achieved by maintaining both the current value of every atom (in the hashtable) and the MSL which was used to create it (in MSL text files). Granularity is achieved by searching through MSL backwards, beginning with the expression from which the rewind is started, through the expression where the rewind is ended, then backwards from the ending point up through the containing expression until all values can be rendered in
2-form with no dependencies. Note that it is not necessary to re-evaluate all the MSL "from the beginning" to determine an atom's previous value. It's only necessary to evaluate the last (
2-form) expression which set the atom's value, working backwards.