2015-07-30 19:12 GMT+02:00 Scott Arciszewski <sc...@paragonie.com>: > On Mon, Jul 27, 2015 at 2:03 PM, Anthony Ferrara <ircmax...@gmail.com> > wrote: > > Rowan, > > > >> This is certainly some people's concern, but Anatol has raised a subtly > >> different consistency-related point, which is this: > >> > >> Since we have no policy for what kinds of Throwable should be emitted in > >> what circumstance, throwing anything in this function sets a precedent > which > >> will have to be incorporated in any future plan. > >> > >> Assuming nobody is fundamentally against ever adding Throwables to core > >> functions, there are a minimum number of questions that need to be > agreed > >> before adding the first one: > >> - when should we inherit from Error and when from Exception? > > > > IMHO, Errors signify programmer error, where Exceptions signify > > unknown or runtime errors. Meaning that an Error should always be a > > problem with your code, but an Exception could be a systems problem, a > > user problem or a problem in your code. > > > > While that's slightly off-topic to this discussion, it frames which > > type random_* would throw pretty clearly (Exception). > > > >> - is it ever OK to throw a plain Error or Exception (thus forcing users > into > >> the otherwise bad practice of catching those base classes)? > > > > For now, I think that's a good practice. It doesn't constrain us from > > sub-typing down the road (7.1, etc), but it also lets us build the > > support in today. > > > > For example, if we throw Exception, in 7.1 we could make it > > php\RandomException in 7.1 without issue (all we need to get right is > > the hierarchy parent). > > > >> - if not throwing the base class, how specific should sub-classes be? > (i.e. > >> a framework for defining the hierarchy, not necessarily the hierarchy > >> itself) > > > > I think this is something that should be RFC'd for 7.1. I don't think > > that limits us here though. > > > >> If we can get agreement on those points in time for 7.0, fine, but time > is > >> very tight, and the window for such discussions has theoretically > closed... > > > > I think the only real agreement we need is Error vs Exception. If we > > can agree on one of those, we can do the rest in 7.1 without worrying > > about BC... > > > > Anthony > > I'm fine with either Error or Exception. I'd prefer Exception (easier > to write a sane backport for PHP 5.6) but I leave this decision in the > hands of others. > > /** > * Slightly insane PHP 5 backport but it works > */ > class Error extends Exception { } // Done! > > Does anybody feel particularly strong about one or the other? > > If so, should we set up a vote somewhere? (I don't vote karma on RFCs > etc. so I don't know if the existing infrastructure would work.) > > If not, can we get PR 1397 & 1398 merged? :) > > Regards, > > Scott Arciszewski > Chief Development Officer > Paragon Initiative Enterprises <https://paragonie.com> > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > I prefer Exception, too, because it's I/O related.
@Scott: You can open votes on everything, doesn't matter, just create a page with a vote. I just don't know where to put it in the wiki, because it's not a RFC. Regards, Niklas