D - should CPU/OS exceptions be a sub class of Exception rather than Exception with a msg ?
- Mike Wynn (15/15) Mar 08 2003 Walter,
- Walter (6/21) Apr 16 2003 You're probably right. -Walter
- Matthew Wilson (14/43) Apr 17 2003 Despite OO being a stillborn concept, especially the way Java, .NET and ...
Walter, could AccessViolations and other OS/CPU exceptions be a different sub class of Exception so they can be caught without having to blanket catch Exception; I quite like the Java Exception inheritance tree; Throwable <-Exception <- RuntimeException <- ArrayIndex etc etc things you might want to catch Throwable <- Error <- Things you normaly would not want to catch. this is partly because I'm playing with mem mapping a file (readonly) so want to be able to catch writes without other exceptions and partly because I think there should be a try { ... } catch ( Foo e ) { ... } that lets you catch a range of exceptions such as just D runtime exceptions, just CPU excepions, just null pointer exceptions or just non program error (i.e. file io) exceptions etc.
Mar 08 2003
You're probably right. -Walter "Mike Wynn" <mike.wynn l8night.co.uk> wrote in message news:b4e03m$ssh$1 digitaldaemon.com...Walter, could AccessViolations and other OS/CPU exceptions be a different subclassof Exception so they can be caught without having to blanket catch Exception; I quite like the Java Exception inheritance tree; Throwable <-Exception <- RuntimeException <- ArrayIndex etc etc thingsyoumight want to catch Throwable <- Error <- Things you normaly would not want to catch. this is partly because I'm playing with mem mapping a file (readonly) so want to be able to catch writes without other exceptions and partly because I think there should be a try { ... } catch ( Foo e ) { ... } that lets you catch a range of exceptions such as just D runtimeexceptions,just CPU excepions, just null pointer exceptions or just non program error (i.e. file io) exceptions etc.
Apr 16 2003
Despite OO being a stillborn concept, especially the way Java, .NET and D derive everything from a root object, there is one place where it is not only harmless but +vely useful: exceptions. Every exception should be in an inheritance tree. Also, I agree that one of the (extremely) few good things about Java is the exception model. Not like the inconsistent mess of .NET. Let's do something like that with D. I've just realised that, for some stupid reason, one of the exceptions I did for a D library didn't declare a parent class. I think I assumed it would derive automatically from Exception - barmy! I'd better go and fix ... (sheepish grin) Matthew "Walter" <walter digitalmars.com> wrote in message news:b7kf9c$2df6$2 digitaldaemon.com...You're probably right. -Walter "Mike Wynn" <mike.wynn l8night.co.uk> wrote in message news:b4e03m$ssh$1 digitaldaemon.com...Walter, could AccessViolations and other OS/CPU exceptions be a different subclassof Exception so they can be caught without having to blanket catch Exception; I quite like the Java Exception inheritance tree; Throwable <-Exception <- RuntimeException <- ArrayIndex etc etc thingsyoumight want to catch Throwable <- Error <- Things you normaly would not want to catch. this is partly because I'm playing with mem mapping a file (readonly) so want to be able to catch writes without other exceptions and partly because I think there should be a try { ... } catch ( Foo e ) { ... } that lets you catch a range of exceptions such as just D runtimeexceptions,just CPU excepions, just null pointer exceptions or just non program error (i.e. file io) exceptions etc.
Apr 17 2003