* rfc: script exit value from ENTRY-POINT retval
@ 2010-07-22 9:00 Thien-Thi Nguyen
2010-07-24 21:53 ` Neil Jerram
0 siblings, 1 reply; 2+ messages in thread
From: Thien-Thi Nguyen @ 2010-07-22 9:00 UTC (permalink / raw)
To: guile-devel
In Guile 1.4.x, i just installed this:
* for scripts with -e ENTRY-POINT, exit value is ENTRY-POINT retval
Previously, ENTRY-POINT retval was ignored; scripts would always exit
successfully (exit value of zero) unless ‘exit’ was called explicitly.
This change is backward compatible if you explicitly call ‘exit’;
there is no change in behavior. On the other hand, if ENTRY-POINT
blithely returns #f or a non-zero integer, that value is no longer
masked; the script will now exit failurefully.
This change removes the small but gratuitous conceptual discrepency
between C ‘main’ and Scheme ENTRY-POINT, making ENTRY-POINT easier to
use internally, generally (caller no longer needs to catch ‘quit’).
In Guile 1.4.x, all scripts/* programs use ‘HVQC-MAIN’, which does
‘exit’ explicitly. The other big corpus of scripts i have experience
with is ttn-do, which used to use ‘HVQC-MAIN’, but now (with the intent
of porting to Guile 2) uses a simpler mechanism that generally does NOT
do ‘exit’ explicitly.
What do people think of making this change in Guile 2.x and 1.8.x?
(Included in the change would be an audit/update of bundled scripts.)
thi
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: rfc: script exit value from ENTRY-POINT retval
2010-07-22 9:00 rfc: script exit value from ENTRY-POINT retval Thien-Thi Nguyen
@ 2010-07-24 21:53 ` Neil Jerram
0 siblings, 0 replies; 2+ messages in thread
From: Neil Jerram @ 2010-07-24 21:53 UTC (permalink / raw)
To: Thien-Thi Nguyen; +Cc: guile-devel
Thien-Thi Nguyen <ttn@gnuvola.org> writes:
> In Guile 1.4.x, i just installed this:
>
> * for scripts with -e ENTRY-POINT, exit value is ENTRY-POINT retval
>
> Previously, ENTRY-POINT retval was ignored; scripts would always exit
> successfully (exit value of zero) unless ‘exit’ was called explicitly.
>
> This change is backward compatible if you explicitly call ‘exit’;
> there is no change in behavior. On the other hand, if ENTRY-POINT
> blithely returns #f or a non-zero integer, that value is no longer
> masked; the script will now exit failurefully.
>
> This change removes the small but gratuitous conceptual discrepency
> between C ‘main’ and Scheme ENTRY-POINT, making ENTRY-POINT easier to
> use internally, generally (caller no longer needs to catch ‘quit’).
FWIW, I don't find this compelling. As I see it, this change increases
the complexity of the rules that a script writer has to know, for no
apparent benefit.
To explain in detail what I mean...
The rule before was: the specified exit value if the script called (exit
...), otherwise 0.
The proposed new rule is: the specified exit value if the script called
(exit ...), otherwise an integer representation of the entry point's
return value.
The new rule is much more complex, because it requires understanding how
every possible Scheme value can be converted to an integer exit value.
So, in return for that complexity, there should be some benefit. But I
don't see any - because any script that cares can simply add a call to
(exit ...).
Am I missing something? What in particular motivated this change in
Guile 1.4.x?
Regards,
Neil
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-24 21:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-22 9:00 rfc: script exit value from ENTRY-POINT retval Thien-Thi Nguyen
2010-07-24 21:53 ` Neil Jerram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).