Re: The Next Move in Programming
From: Nils Gösche (ngo_at_cartan.de)
Date: 02/26/04
- Next message: taltman_at_noshpam.lbl.government: "Re: rational arithmetic library?"
- Previous message: a: "Re: Popularity of programming languages"
- In reply to: RobertMaas_at_YahooGroups.Com: "Re: The Next Move in Programming"
- Next in thread: Christian Lynbech: "Re: The Next Move in Programming"
- Reply: Christian Lynbech: "Re: The Next Move in Programming"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Feb 2004 03:43:53 +0100
RobertMaas@YahooGroups.Com writes:
> > Don't do that. It's better to use something like ERROR or
> > CERROR. This gives you more opportunities to gracefully deal with
> > such situations. (The "C" in "CERROR" means "correctable", and
> > this is intentional. ;)
>
> Bad advice in many cases.
Not at all.
> If you are debugging the code, and you have full access to
> interactive debugger etc., CERROR is often a good idea initially
> when your code discovers something that isn't supposed to happen per
> your original design of the code. But as soon as you pass the code
> to customers/users, you do *not* want low-level utilities producing
> CERRORs deep down in a context that is meaningless to the
> customer/users. You want low-level code passing some sort of error
> signal up to high-level code, which can then explain in a meaningful
> way what part of the processing went bad, and then gracefully
> recover by avoiding the troublesome part of the program until it can
> be fixed. This is especially true when writing CGI or other
> WebServer applications, where the read-eval-print loop is not
> connected to any actual user in an interactive way, so invoking
> CERROR (or ERROR) is a total disaster even when testing your own
> code.
>
> One alternative to the two ideas above is to THROW all the way from
> the point of error up to a standard location where there's a
> CATCH. For example, if the user issues a command, and some bug is
> detected during the execution of that command, the top-level of
> executing that command might be a good place to put the CATCH. The
> user could then be told something like the following: An error
> occurred deep down inside the program that handles your command
> "Delete Record": Invalid array index 47, should be in range 0 to 46,
> occurring inside HASH-CHAIN-3 which is called from HASH-CHAIN which
> is called from inside GETHASH ... The error has been logged as
> 2004022517a, which has been reported to programming staff. Your
> command has been terminated. You are back to where you were before
> you invoked that command.
And why can't you do that with HANDLER-BIND or HANDLER-CASE?
Regards,
-- Nils Gösche "Don't ask for whom the <CTRL-G> tolls." PGP key ID #xEEFBA4AF
- Next message: taltman_at_noshpam.lbl.government: "Re: rational arithmetic library?"
- Previous message: a: "Re: Popularity of programming languages"
- In reply to: RobertMaas_at_YahooGroups.Com: "Re: The Next Move in Programming"
- Next in thread: Christian Lynbech: "Re: The Next Move in Programming"
- Reply: Christian Lynbech: "Re: The Next Move in Programming"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]