Mauro wrote:
> My question of the day is: what mechanism can be used to
(programmatically) test whether the execution of a Rebol script has been
successful or not?
>> S1: [print "This is S1" true]
== [print "This is S1" true]
>> do s1
This is S1
== true
>> S2: [print "This is S2" false]
== [print "This is S2" false]
>> do s2
This is S2
== false
>> SE: [print a string that is not in double quotes true]
== [print a string that is not in double quotes true]
>> either error? Result: try [do SE][print "There was an error?"][print "All
OK!"]
There was an error?
>> either error? Result: try [do S2][print "There was an error?"][print "All
OK!"]
This is S2
All OK!
>> either error? Result: try [do S1][print "There was an error?"][print "All
OK!"]
This is S1
All OK!
I hope that helps! :-D
Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-
----- Original Message -----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 24 February 2000 10:31 PM
Subject: [REBOL] Script return code
First of all, thanks to everybody who promptly answered my former question
on email attachments.
My question of the day is: what mechanism can be used to (programmatically)
test whether the execution of a Rebol script has been successful or not?
If I'm right, a script has no way to return an "exit code" which would
provide the usual mechanism found on Unix. While it is true that the script
might output the equivalent of a return code, this works fine provided that
the script doesn't do any other kind of output. In other words, it'd be
suitable for batch-oriented scripts which don't write anything else on
stdout/stderr.
In my opinion, the formalized notion of a return code is essential,
especially when one has to "glue" together scripts and/or applications and
drive their execution by means of a higher-level program (e.g., a shell
script), taking into account failures etc. The presence of the return code
should also be transparent to the user, i.e. it shouldn't interfere with the
execution of the script (like altering its output).
Any idea of why such a feature hasn't been incorporated in the language?
Concerning cross-platform portability, a solution a la exit() is as portable
as C.
Thanks for your help,
Mauro