From: Andreas L. <av...@lo...> - 2008-11-25 18:26:25
|
On Tue, Nov 25, 2008 at 07:44:32PM +0200, Twylite wrote: > >If you think, that embedding switches is a good idiom, then > >why not just match the [lindex $errorCode 0] ... > Because that's so unspecific as to be worthless in most cases. This > would allow you to distinguish between (say) POSIX errors and ARITH > errors, but in most cases where you need to branch based on the type of > error you are distinguishing between two very similar errors (an IO > timeout error versus an IO read error, ... Ok. Agreed. That is common enough to justify an idiom more concise than a nested switch. Even {CHILDKILLED * SIGSEGV *} may have its use. The errorCodes thrown from core appear to have been carefully crafted to be reasonably glob-able. At this point in time, glob appears like the perfect hammer for the nail, but nails are likely going to change when programmers get more into the habit of creating new errorCodes for their applications, and introducing ambiguities, that could have been avoided by list patterns in the first place. |