Re: [Windows] Associate file extensions with a program

new topic     » goto parent     » topic index » view thread      » older message » newer message

Juergen Luethje wrote:
> 
> Pete Lomax wrote:
> 
> > On Mon, 11 Oct 2004 12:43:40 +0200, Juergen Luethje <j.lue at gmx.de>
> > wrote:
> >
> >> Pete Lomax wrote:
> >>> PS: Please do not return False to indicate success.
> >>
> >> It's a habit of mine.
> > OK, if it's a habit, then I withdraw my request. I guess it is only a
> > habit of mine to return 1, since I rarely bother to return specific
> > error conditions.
> 
> Unfortunately, it's not possible anyhow, to consistently return errors
> as function values. E.g. in many math functions, we can't return a
> number such as -1, 0 or 1 as error values, because these values might be
> normal results of that function.
> We could return e.g. {} to inicate an error, or even {1}, {2} to
> indicate specific errors. But there are also functions, that legally can
> return arbitrary objects.

I've been using the method of always returning a sequence; the first
element is the return code and the second is the function value.

> I'll think about my habits in this regard. Maybe it's cleaner to use a
> global error variable.

A simple global error variable is a *bad* idea. It can lead to subtle
bugs if you cannot guarentee that the function you called is the *only*
function that sets the single shared error variable. 

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu