On Nov 20, 2007, at 7:57 AM, Dave Thomas wrote: > > I can see the reason for distinguishing the three, but I think that > using an exception might be a bit too much: most of the time, you > simply want to write > > if system(...) > > As a user of the API, your first priority is knowing whether it > worked. You _might_ then be interested in knowing why if it failed. > I'd definitely support the nil/false approach over using an exception. i know i'm in the minority in saying i support true/false/exception, but i thought i'd pop in because i'm pretty sure i've done more sub- process spawning that most of the people on the list and my experience driving tens of thousands of processes simultaneously is that there are two main cases 1) the command executes and you get back an exit code. true and false work fine here - we have $?.exitstatus for more. this works in 95% of cases. 2) the command did not execute. this can be for a variety of reasons ENOENT # not found EPERM # found, but you don't have permission EIO # your disk is blowing up, nfs is totally fubar ENOMEM # buy more ram etc. note that all these errno values might by from a program *or* they may occur before the program has even started. i think it's very important that a program actually executing and returning a status be distinguished from the host of reasons it might not be executed since, in most cases, not executing seems like 'exceptional' behavior if anything ever has. note that stuffing the errno into $? doesn't work because the implication then is that the program caused that status - rather than the exec family function that failed. so i guess my position is that although 'nil' is nice and simple this simply isn't a tri-state failure pattern and that modeling it like that encourages shoddy error checking - one of my biggest pet peeves in scientific programming specifically and programming in general. kind regards. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama