Maybe I wasn't clear enough, my posting was referring to situations in which one
has to "glue" together the execution of multiple scripts, not necessarily all of
them written in Rebol. A motivation could be legacy applications (if we call
"legacy" whatever is already there and we won't/can't modify/rewrite).
To give a real example, I need to integrate a number of Perl scripts with Rebol
scripts; I'm doing that via a main shell script - though this detail is not
relevant. In my case it's not a question of legacy software - I had to write
some pieces in Perl because I need to access a RDBMS, something I can't do today
in Rebol.
So the "driver" script (the high-level shell script in my case) needs to know
what's going on with the execution of the Perl and Rebol scripts. Perl poses non
problem, but with Rebol I can't use the same mechanism. Of course I can have it
worked out - I was wondering if anybody else felt my same need.
I think the matter may be considered on the level of "design principles" or, in
some sense, on the "philosophycal" side of what one expects from a programming
language...
Ciao
Mauro
[EMAIL PROTECTED] wrote:
> 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
begin:vcard
n:Bregolin;Mauro
tel;fax:+39 049 8073066
tel;work:+39 049 8073066
x-mozilla-html:TRUE
adr:;;
version:2.1
email;internet:[EMAIL PROTECTED]
end:vcard