operator
true
when the contents are defined or have been defined, and false
otherwise. Replacing is
with isnt
will reverse the resultsthis? referents indexer? (is | isnt) attached
A referent is attached when its contents have been defined. However, the referent is no longer attached if a particular referent's contents have been specified, the referent has been closed, and the stream bound to that referent is subsequently discarded.
this
indicates the currently selected referent. Indexer is a phrase identifying which referent is to be examined. The two cannot be combined.
This code sample illustrates using the "referents...is attached
" test. The sample also shows that if a referent has been closed and the stream bound to that referent discarded, then the referent is no longer attached.
macro attach-check token ref-name is do when referents{ref-name} is attached output "attached%n" else output "not attached%n" done macro-end process local stream s output referent "x" ; referent "x" is not attached attach-check "x" open s as referent "x" ; referent "x" is attached now attach-check "x" put s "some contents%n" ; still attached attach-check "x" close s ; still attached attach-check "x" discard s ; referent "x" is no longer attached attach-check "x" set referent "x" to "more contents%n" attach-check "x" ; attached now so we end up with a value