On Fri, Aug 31, 2012 at 5:46 PM, Andrew Faulds <a...@ajf.me> wrote:

> On 31/08/12 13:47, Ferenc Kovacs wrote:
>
>> It was also mentioned in that thread that we already have a bunch of
>> exceptions in spl, and some of the spl features should be in the core (or
>> it is already in the core for example IteratorAggregate).
>>
> I personally don't see why SPL is separate from core PHP, especially since
> it's required. Why must the core not have OO stuff, but have non-OO stuff?


The spl ext has exceptions all around, so if would count spl as "core", we
have exceptions in the core already, so it would be ok to add more
exceptions where appropriate.
About OOP vs procedural: as I explained, we should still only use
exceptions in the core where it is appropriate, if somebody sees a
procedural api, he/she could be surprised if said api starts mixing OOP
here through throwing exceptions around. On the other hand when somebody
uses OOP features it would be natural for him/her that there could be
exceptions on the way.


>
>  Personally I think that OOP features should be allowed to throw
>> Exceptions,
>> and I think that it would still in line with the our users expectations.
>> The only problem that I can think of is that for some stuff, we have both
>> a
>> procedural and an oop API, but I'm not proposing turning everything into
>> Exceptions, but using them where appropriate.
>>
>>  Not for PHP 5.5 (if that's happening?), but for PHP 6 I think a lot of
> things should become exceptions.


>From the impression that I get from reading through the mailing list
threads and the irc discussions I think that there aren't that many things
that could turn into exceptions.
E_RECOVERABLE_ERROR and probably that's it.


> I don't think that, personally, PHP's current error handling system is
> sufficient for properly handling errors.


It is working for years, it could be improved but I wouldn't call it
insufficient.


> I think it's fine for warnings, notices, and deprecations.


Yeah, continuing the execution and still being to handle/log multiple
notices is something that wouldn't be possible with exceptions.


> It's well suited to that kind of thing, and for that it should be kept
> (along with completely fatal core errors, where instantiating an object is
> inappropriate or impossible.) And yes, I think there should be exceptions
> in core PHP where appropriate
>

Agree on both cases, but please don't turn this thread into discussing the
viability of turning the php current error handling into exceptions, we
have threads for that.
This thread is about whether or not it is fine for a (new)core feature to
throw exceptions if appropriate.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

Reply via email to