I was going to embark on a rant about this, but then I read the PDD, and i realized the entire exception subsystem is a farce.
That which is documented is inadequate and poorly thought out. And that which is implemented doesn't do even remotely what is documented.
The pdd makes the assumption that exception filtering will be done based on 'type', but provides no mechanism for extending the 'types'. The logical (and widely popular) alternative is to filter based on subclass. The pdd's answer to that is that you can throw anything, if you just stuff it in the payload. So naturally, the parameters to the exception handler objects are the...
...exception and it's *message*.
The throw/rethrow ops differ in that rethrow marks the exception unhandled. IMO, rethrow should be transparent - particularly, the exception backtrace should still point at the original location where the exception occured. The pdd makes nothing of this, and naturally parrot gets it wrong.
There are too many categories of severity, too many attributes (backtrace versus resume versus thrower; severity versus exit code versus type versus class).
So there you have it, a pretty succinct criticism of Parrot's exception system. I'll be elaborating on some of these ideas in the next few days.
I've created a wiki page for this, optimistically titled: http://trac.parrot.org/parrot/wiki/ExceptionRefactor
ReplyDeleteThat's good! It's always good to take problems and start planning solutions. I have another blog post scheduled for thursday morning that goes into much more depth about some of the problems I have found in the design. I'll take a look at this wiki page and update my critique as necessary.
ReplyDelete