|
|||||
Referents: attaching to streams | |||||
Prerequisite Concepts | Related Syntax |
A referent can be attached to only one stream at a time. When the stream is closed, it still retains the attachment to that referent.
Attaching the same referent to a different stream "snaps" the previous attachment. At this point, the reopen
and name of
functions can no longer be used with the previous stream.
The only difference between using a set referent
and an open-put-close
sequence of actions is that the referent is not attached to any stream after the set referent
action.
While attached to a stream, the contents of a referent can be accessed with the "%g" format item in the same manner as other buffers. The content of the referent will be its content at the time it is accessed. Unlike other buffers, however, referents can be "attached" to other streams (by open
or reopen
functions). When a referent is attached to a stream, it is "detached" from whatever stream previously opened it. When this happens a "%g" that uses the previous stream is no longer allowed.
The close
, reopen
, and discard
functions can also refer to streams attached to referents:
reopen
reopens the stream with its previous attachment.
discard
is applied to a closed stream attached to a referent, the attachment to the referent is broken but the referent itself remains intact. The stream item simply becomes unattached.
discard
is applied to an open stream attached to a referent, the attachment to the referent is broken, and the referent itself is destroyed. It is as if the referent had never been created.
Prerequisite Concepts Referents Referents: final destinations Streams: attachments |
Related Syntax set referent |
---- |