|
|||||
operator | has name | ||||
Related Syntax | Related Concepts |
Summary |
Boolean
Returns true if the specified stream item has a name, and false otherwise. Replacing |
stream? stream-name indexer? (has | hasnt) name
Streams that are attached to files, referents and external functions have names. Also, the built-in stream #markup-parser
can have the name "XML" or "SGML."
If the stream has a name, the name of
operator can be applied to the stream item to return a string expression containing the name of the stream.
The built-in stream #main-output
has a name when it has been attached to a file on the command line that has "-of" or "-aof" options.
This example illustrates the use of has name
to test whether a specified stream has a name. This is done in order to avoid the error of using the name of
test on a stream that does not have a name.
global stream new-output ... do when new-output has name do unless name of new-output = "new-out.txt" put #error "stream new-output has unexpected name: " put #error name of new-output halt with 1 done else put #error "new-output was never opened " _ "as file or referent%n" halt with 1 done
Related Syntax #main-output #markup-parser external-function name of referents |
Related Concepts Streams: name tests |
---- |