[mercury-users] Way to exit immediately from a Mercury program?

Nicholas Nethercote njn at csse.unimelb.edu.au
Wed Apr 26 13:30:26 AEST 2006

On Wed, 26 Apr 2006, Julien Fischer wrote:

>> Is there any way to call exit() in a Mercury program?  I've found
>> io.set_exit_status/3, but I thought there might be an io.exit predicate.
> There's nothing like io.exit.  Why do you need it?

To exit from the Zinc compiler when something like a bad option name is 
encountered.  Currently I have to make sure that the if-then-elses are done 
in such a way that if a bad option is encountered then no real code follows 
the bad-option-handling code before the end of main/2 is hit.

If io.exit existed I could just call my predicate bad_option (which would 
call io.exit after printing a message) and not have to worry about the 
subsequent control flow.  Maybe this breaks declarative semantics or 
something, although since it's within the IO code I wouldn't have thought it 
would be a problem.  Anyway, it's not a big problem.

mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list