A stream is always opened with a destination, called an attachment. There are three kinds of stream attachments:
Buffers, which serve a function analogous to string variables in other programming languages. They are used to store the results of string expressions for use later within the program.
Files, which OmniMark can create and write to files in the external file system. This is a useful way of saving information that can be used by applications that will run at a later time.
Referents, which are a feature designed specifically for hypertext applications. They are used to resolve forward references (references into a part of the document that has not been processed yet). Briefly put:
These operations can be done in any order; OmniMark will remember where the referents have been written to, and will replace the referent with its final contents when the referent resolution is complete.
Referent resolution is usually performed after the program completes. The programmer can also define nested referent scopes. The referents created and written in a nested referent scope will be resolved when the scope completes.
Streams are initially unattached.
A stream is:
bufferif the stream is attached to a buffer
fileif the stream is attached to a file
referentif the stream is attached to a referent
externalstream if the stream is attached to an externally defined output stream
attachedif any of the above are true