RE: [PHP-DEV] Class constructor behaviour
| From: | François Laupretre | Date: | Sun, 18 Jan 2015 06:32:50 +0000 |
| Subject: | RE: [PHP-DEV] Class constructor behaviour | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80726@lists.php.net to get a copy of this message | ||
> De : Andrea Faulds [mailto:ajf@ajf.me]
>
> I don’t really agree here. For some reason we have this tradition of not using
> exceptions for “procedural” stuff. That sort of makes sense for functions, but
> classes are “OOP” and therefore I don’t see a good reason why they
> shouldn’t throw exceptions. Exceptions and OOP (and namespaces, even)
> should not be the domain of userland exclusively, they are also the domain
> of internals/core. If you really hate exceptions, I’d say you should just use
> one of those ridiculous “procedural” alternative functions (that are just
> methods in disguise) that we went to the bother of adding.
I agree. I just remembered that, in in the past, every proposal which included exceptions in the
core were discarded. I also would prefer exceptions to this old error system. If minds (or people)
have changed, that's a very good thing.
François