[REBOL] how to correctly unset a word?
From: petr::krenzelok::trz::cz at: 25-Apr-2003 14:45
Hello,
I have a following scenario when communicating with our device:
ccd: open tcp://some-port:55
.... then we send some instructions, read an image ...
close ccd
but - sometimes there is some transfer problem and scripts waits for
something. Then Rene presses escape, to get back to console - but in
such case, "close ccd" is not applied. When Rene redoes the script, it
tries to connect to our device, but it still may have its port opened
(there is only one tcp socket to use), so we would need to close it
somehow ....
I tried something as following to put at the beginning of the script:
if not value? 'ccd [close ccd]
... but it does not work, becase if everything goes well, script does
what it is supposed to do and closes the connection - next time the
script is redone from console, "value? 'ccd" still returns true so
close ccd
is applied to non-existant port and error is returned. Is
there any chance of anyhow unset the 'ccd value, so if we do the script
from console once again, it looks if 1) port is closed 2) if closed?,
then unsets the value?
Strange thing is:
->> ccd: open tcp://:1024
->> close ccd
->> value? ccd
== true
->> unset 'ccd
->> value? 'ccd
== false
->> unset? 'ccd
== false
Why unset? 'ccd does not return 'true? I am somehow confused about that
stuff :-)
Thanks,
-pekr-