Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87328 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22548 invoked from network); 27 Jul 2015 18:03:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jul 2015 18:03:26 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.181 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.217.181 mail-lb0-f181.google.com Received: from [209.85.217.181] ([209.85.217.181:36666] helo=mail-lb0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7D/D4-17059-D6276B55 for ; Mon, 27 Jul 2015 14:03:26 -0400 Received: by lbbqi7 with SMTP id qi7so58808721lbb.3 for ; Mon, 27 Jul 2015 11:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=YI6feF0nPgdxOyeXbt+aJuVh490zLf23QJTqb9I4L9A=; b=BSBNYSsNQJIVsH5HWxBODzqvSCuB4lut9FrK1vTU/fuvjxUHNE/MxOXTz13m44h6pO kW6yLmOUxaQArItFOnEniIlU0w0SDhNfu2F4Cz0FPCvfzVwvzSdJPoviY+kXxTivuPfB IOa9ny2H/mtZeIYaq2JmUPii64viXeySX8RrFxVJTBCHo0MVD/fDw+1ijOA/BNerAtWc dsSIsahGp6LLgHRsaBqTROYEGZMVQcBckccOkGk+dFJ/kJdFlK67fis4MN6IB050K//u zN1O72zGkruU+x1/stmGMss8pVEO+Cu8+5TZ/s9ix8VVaZaHzDEMtD4N/r1p3Lzfy4bw EwTA== MIME-Version: 1.0 X-Received: by 10.152.203.162 with SMTP id kr2mr28407173lac.57.1438020202777; Mon, 27 Jul 2015 11:03:22 -0700 (PDT) Received: by 10.25.90.75 with HTTP; Mon, 27 Jul 2015 11:03:22 -0700 (PDT) In-Reply-To: <55B6707A.3040405@gmail.com> 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: Mon, 27 Jul 2015 14:03:22 -0400 Message-ID: To: Rowan Collins Cc: Scott Arciszewski , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Core functions throwing exceptions in PHP7 From: ircmaxell@gmail.com (Anthony Ferrara) 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