Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87414 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46298 invoked from network); 30 Jul 2015 18:27:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jul 2015 18:27:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.217 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.217 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.217] ([81.169.146.217:32599] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/A1-34806-2AC6AB55 for ; Thu, 30 Jul 2015 14:27:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1438280863; l=8295; s=domk; d=kelunik.com; h=Content-Type:Cc:To:From:Subject:Date:References:In-Reply-To: MIME-Version; bh=xLGNNrQsGFZzCZOaiCTvPwE24jD937IU0N3JllMgx1E=; b=a4wqP1l4yKhOqNT5JyjYPxT+8BEVlkuQKbrmIkV4//+SFMqn7LXTmGphcmU91N+nz0P aKZ9SZq1YKijTl4ayDRRVBotL/Z/cfAKeP2gr/ulb8x7eUNzyDUfj0/BjNFWhX4r6yGt/ /KIYQg5dJEN3wXM7HAq5IpuYvMNW8COBeO4= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNNBqD/syo= X-RZG-CLASS-ID: mo00 Received: from mail-wi0-f173.google.com ([209.85.212.173]) by smtp.strato.de (RZmta 37.8 AUTH) with ESMTPSA id f0469dr6UIRhv54 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate) for ; Thu, 30 Jul 2015 20:27:43 +0200 (CEST) Received: by wibud3 with SMTP id ud3so3106791wib.0 for ; Thu, 30 Jul 2015 11:27:43 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.207.242 with SMTP id lz18mr8456952wic.66.1438280863841; Thu, 30 Jul 2015 11:27:43 -0700 (PDT) Received: by 10.27.204.197 with HTTP; Thu, 30 Jul 2015 11:27:43 -0700 (PDT) In-Reply-To: References: <836BA21C-AE99-4E7B-AB06-EBC30E41BA0E@icicle.io> <0AD335F5-35F3-4D98-8F82-800A1EDF8FD8@icicle.io> <05f101d0c838$fcdab5e0$f69021a0$@belski.net> <55B63FDF.6050100@gmail.com> <55B66494.1020106@gmail.com> <55B6707A.3040405@gmail.com> Date: Thu, 30 Jul 2015 20:27:43 +0200 Message-ID: To: Scott Arciszewski Cc: Anthony Ferrara , Rowan Collins , PHP Internals Content-Type: multipart/alternative; boundary=001a11c3fa76fa08c3051c1bdb64 Subject: Re: [PHP-DEV] Core functions throwing exceptions in PHP7 From: me@kelunik.com (Niklas Keller) --001a11c3fa76fa08c3051c1bdb64 Content-Type: text/plain; charset=UTF-8 2015-07-30 19:12 GMT+02:00 Scott Arciszewski : > On Mon, Jul 27, 2015 at 2:03 PM, Anthony Ferrara > 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 > > -- > 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 --001a11c3fa76fa08c3051c1bdb64--