On Mon, 12 Apr 2004 13:02:19 +0200
[EMAIL PROTECTED] (Andrey Hristov) wrote:

> Derick Rethans wrote:
> > 
> > 
> > I think it's a stupid idea (actually OO is a stupid idea but
> > that's something for another dicussion ;-):
> > 
> > 1. In order to silently ignore failed queries you still have to
> > put a
> >    stupid try..except block around it.

> If it's used only in object context.

And why OO codes should be overbloated with exceptions for non fatal
errors? I do not talk about fatal userland errors but fatal php
erros. But I may be a too old fashion programmer, where exceptions
were used to avoid crash, ugly exit and but not control flow.

I feel these exceptions issues more like the other "OO fanatic"
discussions. It will fall in many annoyed things in our codes,
depending about how the maintainers use exceptions. For instance
(I took tidy codes, no offence for the authors, I like tidy, but
not its exceptions usage):

    if (tidyOptIsReadOnly(opt)) {
        TIDY_THROW("Attempt to set read-only option '%s'", optname);
        return FAILURE;
    }

Ah? Sounds more like a notice to me. This kills the KISS.

My nightmare (shows the E_ERROR/E_WARNING issues explained in other
posts):
./sapi/cli/php -n -r 'tidy_parse_file("foo");echo "bar";'

The worst is:
tidy_get_opt (internal function name) which raises an exception if
the option does not exist. What a nightmare if I have to try{}catch
every piece of codes because the KISS'ed value/false principle is
droped in the name of OO.

So yes, a little HOWTO for the usage of exceptions should be nice,
both for internals and userland. But if the goals is to follow these
examples, then I ask to add an ini option: use_crappy_exceptions
On|Off

my little 2cts on this topic,

pierre

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to