i've looked at the latest Zend CVS and like what i see with regards to
exceptions, and i'd like to make a suggestion.

in other languages (c++, delphi and Java for sure), you can specify the type
of exception you are interested in in the catch block. short of this, the
programmer would have to check nearly every exception value returned and
rethrow if she cannot handle it

try {
    barf();
} catch ($url) {
    if  ( is_subclass_of($url,'badFoodException') ) {
        echo "shoulda had a beer";
    } else
        throw ($url);
}

instead of

try {
    barf();
} catch(badFoodException $url) {
    echo "shoulda had a beer"
    /* all other exceptions are propagated */
}

in the aformentioned languages (Python also), it implies that there is a
system defined base exception class from which all other exceptions descend.
this is not a bad idea, although an internal subclass check would work
irrespective of the type of value thrown.

Delphi works this way - you can throw any object, though by convention you'd
throw a subclass of the EException class.

l0-t3k



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to