Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-04 Thread Gustavo Lopes
On Tue, 04 Sep 2012 01:27:12 +0200, Stas Malyshev smalys...@sugarcrm.com wrote: to be gained vs. the additional risk. And there is little to no benefit in a model where rewinding a closed iterator is allowed, so the threshold for acceptable risk is very low. This is not a difficult case at

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-04 Thread Alex Aulbach
2012/9/4 Rasmus Lerdorf ras...@lerdorf.com: On 09/03/2012 04:31 PM, Alex Aulbach wrote: 2012/9/4 Gustavo Lopes glo...@nebm.ist.utl.pt: Following this logic, we'd have to convert all E_NOTICE and E_STRICT to fatal errors or exceptions - they are usually produced by programming errors and

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Pierre Joye
hi! On Sun, Sep 2, 2012 at 1:04 AM, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! SPL is not a part of basic language syntax. There are no SPL keywords and no SPL classes used unless you explicitly instantiate those classes. So SPL is different. End users do not see nor buy the

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Derick Rethans
On Sun, 2 Sep 2012, Gustavo Lopes wrote: On Sun, 02 Sep 2012 02:27:02 +0200, Rasmus Lerdorf ras...@lerdorf.com wrote: $things = getStuff(); foreach($things as $thing) { do_some($thing); } which is very normal PHP that you see in millions of lines of code, I would not

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Lester Caine
Derick Rethans wrote: I think the first thing anyone who uses generators must understand is that they are iterators. You forget that not even everybody that uses PHP knows what an iterator is. For all they care, they have an array they can run foreach() on. They should be compared with

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Gustavo Lopes
Em 2012-09-03 13:16, Derick Rethans escreveu: I think the first thing anyone who uses generators must understand is that they are iterators. You forget that not even everybody that uses PHP knows what an iterator is. For all they care, they have an array they can run foreach() on. They

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Stas Malyshev
Hi! They are seen and promoted as core features. Whether we like that idea or not is not really relevant. We messed that up by making most of the Standard PHP Library an extension for only political and licensing reasons. I think you using core here in two difference meanings, and the

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Stas Malyshev
Hi! I've replied here: http://www.mail-archive.com/internals@lists.php.net/msg60706.html I have a feeling you're concocting a very far-reaching scenarios and making a lot of unbased assumptions there to arrive to pre-defined conclusions. Any programming error can cost a business money, and

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Stas Malyshev
Hi! indicating such mental model is widespread and (2) given that the exceptions you claim to be surprising don't happen but for a programming error (i.e. they're not exceptions that need to be caught). Following this logic, we'd have to convert all E_NOTICE and E_STRICT to fatal errors or

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Gustavo Lopes
Em 2012-09-03 23:54, Stas Malyshev escreveu: Hi! indicating such mental model is widespread and (2) given that the exceptions you claim to be surprising don't happen but for a programming error (i.e. they're not exceptions that need to be caught). Following this logic, we'd have to convert

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Gustavo Lopes
Em 2012-09-03 23:51, Stas Malyshev escreveu: I've replied here: http://www.mail-archive.com/internals@lists.php.net/msg60706.html I have a feeling you're concocting a very far-reaching scenarios and making a lot of unbased assumptions there to arrive to pre-defined conclusions. Any programming

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Stas Malyshev
Hi! First, E_NOTICE exists to permit a compromise between people like Zeev that think its introduction was an error and that one should be able to refer to undefined variables and people who prefer a stricter model. For the programmers that follow this stricter model, an E_NOTICE ends ups

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Stas Malyshev
Hi! to be gained vs. the additional risk. And there is little to no benefit in a model where rewinding a closed iterator is allowed, so the threshold for acceptable risk is very low. This is not a difficult case at all, IMHO. We are discussing whether it should lead to the fatal error. I

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Alex Aulbach
2012/9/4 Gustavo Lopes glo...@nebm.ist.utl.pt: Following this logic, we'd have to convert all E_NOTICE and E_STRICT to fatal errors or exceptions - they are usually produced by programming errors and aren't meant to be caught by surrounding code (actually, can't). But I don't see anybody

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-03 Thread Rasmus Lerdorf
On 09/03/2012 04:31 PM, Alex Aulbach wrote: 2012/9/4 Gustavo Lopes glo...@nebm.ist.utl.pt: Following this logic, we'd have to convert all E_NOTICE and E_STRICT to fatal errors or exceptions - they are usually produced by programming errors and aren't meant to be caught by surrounding code

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-02 Thread Lester Caine
Rasmus Lerdorf wrote: On 09/01/2012 05:44 PM, Gustavo Lopes wrote: More importantly, there is no other satisfactory solution (except a fatal error). foreach has no return value, so it has no other way to signal a failure. If we used a notice or a warning here what would happen is that code that

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-02 Thread Gustavo Lopes
On Sun, 02 Sep 2012 03:01:06 +0200, Stas Malyshev smalys...@sugarcrm.com wrote: For me, it behaves exactly like any other iterator would behave if you had no more useful elements in it - meaning, producing no elements. I do not understand why you think it requires immediate break of the code

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-01 Thread Pierre Joye
hi Stas, On Fri, Aug 31, 2012 at 7:31 PM, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! 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. SPL is not a part of basic

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-01 Thread Stas Malyshev
Hi! SPL is not a part of basic language syntax. There are no SPL keywords and no SPL classes used unless you explicitly instantiate those classes. So SPL is different. End users do not see nor buy the difference between what is Zend/ or what is ext/spl (or other) and can't be disabled,

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-01 Thread Lester Caine
Stas Malyshev wrote: Well, not anybody's problem, each guy got his piece committed, written in his favorite style, matching his unique use case, and couldn't care less about anything else. Sounds about right ... I'm doing it this way and everybody has voted that it's OK so go whistle? And we

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-01 Thread Gustavo Lopes
On Sun, 02 Sep 2012 01:04:10 +0200, Stas Malyshev smalys...@sugarcrm.com wrote: SPL is not a part of basic language syntax. There are no SPL keywords and no SPL classes used unless you explicitly instantiate those classes. So SPL is different. End users do not see nor buy the difference

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-01 Thread Stas Malyshev
Hi! * If users do not expect exceptions in the core, they are mistaken. There are indeed exceptions in the core. See ZEND_FE_RESET and zend_interfaces.c. Of course, no evidence has been provided one way or another. This is not right either, but that was done in 2005. We're now in 2012

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-01 Thread Gustavo Lopes
On Sun, 02 Sep 2012 02:27:02 +0200, Rasmus Lerdorf ras...@lerdorf.com wrote: On 09/01/2012 04:51 PM, Gustavo Lopes wrote * In fact, if there is a unifying theme in the usage of exceptions in PHP, is that exceptions are used when OOP interfaces are involved (see Zend interfaces, SPL,

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-01 Thread Gustavo Lopes
On Sun, 02 Sep 2012 02:37:50 +0200, Stas Malyshev smalys...@sugarcrm.com wrote: * If users do not expect exceptions in the core, they are mistaken. There are indeed exceptions in the core. See ZEND_FE_RESET and zend_interfaces.c. Of course, no evidence has been provided one way or another.

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-01 Thread Stas Malyshev
Hi! More importantly, there is no other satisfactory solution (except a fatal error). foreach has no return value, so it has no other way to signal a failure. If we used a notice or a warning here what would happen is that code that used generators with an invalid state would, except

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-09-01 Thread Rasmus Lerdorf
On 09/01/2012 05:44 PM, Gustavo Lopes wrote: More importantly, there is no other satisfactory solution (except a fatal error). foreach has no return value, so it has no other way to signal a failure. If we used a notice or a warning here what would happen is that code that used generators with

[PHP-DEV] Re: Are exceptions allowed in php core?

2012-08-31 Thread Ferenc Kovacs
On Thu, Feb 24, 2011 at 10:29 AM, Ferenc Kovacs i...@tyrael.hu wrote: Hi. it was mentioned multiple times on the list, that exceptions from php core is prohibited. do we have some documentation about this? the more detailed email on this topic was from Lukas:

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-08-31 Thread Andrew Faulds
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

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-08-31 Thread Anthony Ferrara
Ferenc, 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.

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-08-31 Thread Ferenc Kovacs
On Fri, Aug 31, 2012 at 7:03 PM, Anthony Ferrara ircmax...@gmail.comwrote: Ferenc, 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

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-08-31 Thread Stas Malyshev
Hi! 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. SPL is not a part of basic language syntax. There are no SPL keywords and no SPL classes used unless you explicitly

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-08-31 Thread Lester Caine
Ferenc Kovacs wrote: 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. I think it is a matter of identify where exceptions might be appropriate. On