Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69849 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41168 invoked from network); 24 Oct 2013 18:01:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2013 18:01:30 -0000 Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.223.178 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.223.178 mail-ie0-f178.google.com Received: from [209.85.223.178] ([209.85.223.178:48254] helo=mail-ie0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/8D-10840-97069625 for ; Thu, 24 Oct 2013 14:01:30 -0400 Received: by mail-ie0-f178.google.com with SMTP id x13so4491616ief.23 for ; Thu, 24 Oct 2013 11:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=ainHRWUv6hvyHG0jiiIm2ueZHhMop7lPbGdq0FyFmjo=; b=dgQChq1YT+PxDLtO6Lq/TDnAi8qIRFdnq5JbOuGXKVrA/IaCWvJA9n0LSB/fP2eS0o eRlBQHpAYdM7F2VJCQnrMw6+fspl7ruEHD9pTv3PtHo6y3p+865kK5GifX2GOqkF9ktb kGDDJuO7GXlNS++YHUO+Tgb9El9eGUgm9Q7W8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=ainHRWUv6hvyHG0jiiIm2ueZHhMop7lPbGdq0FyFmjo=; b=cCYtYXXG5tHqopjmv7nzp0GfR9GjagYr/mkZtMZFxn86a2fhq5LXJ+mLm0ACVI3AwN jLyI+q41DdFXDPVQC+BDn3Yshl7uzeJXr+ozXvPRsiXCIpEDzH5RWBj3s0Jt+jBF/69z hcDbQU+2x6MGKON46LXktk7CvpzKGAByo/D3IfYNM71HfvvQwDi9FYzL4lDzqWnhw+vp WtA+kCfXONXs2kX9/AnXmI1PAuQkVIuHADHNyKaJe4743XyYd9497MXpUmtFoFtFQIJ9 RI/vz1OJLsjJJooSoYWYbk+LSx5Plb2H/Xn+s9G08ic2qzEc+zJxzRUv+4WUfnIXZYu8 oJ/A== X-Gm-Message-State: ALoCoQkpjTY/jf5DtOMmUrM+lJiLdEZD2Mv1ukDmgtd5quw3IuGi5X27Qg/tur0WbhDxRQKiqQK9 X-Received: by 10.50.225.3 with SMTP id rg3mr2751073igc.28.1382637686869; Thu, 24 Oct 2013 11:01:26 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.42.206.208 with HTTP; Thu, 24 Oct 2013 11:01:06 -0700 (PDT) In-Reply-To: References: Date: Thu, 24 Oct 2013 11:01:06 -0700 X-Google-Sender-Auth: -HbuBSXkYo_kOgBPLNueeZLsptU Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Exceptions in the engine From: aharvey@php.net (Adam Harvey) On 24 October 2013 10:41, Nikita Popov wrote: > I'd like to propose an RFC, which allows the use of exceptions within the > engine and also allows changing existing fatal errors to exceptions: > > https://wiki.php.net/rfc/engine_exceptions > > This topic has been cropping up in the discussions for several of the > recent RFCs and I think the time has come to consider moving away from > fatal errors. > > Thoughts? I love the idea =E2=80=94 unified error and exception handling would be a h= uge win both for simplifying code bases and teaching new developers =E2=80=94 b= ut I don't see any possible way we could do this in a 5.x release. The BC issues are just too great, and too many people rely heavily on the set_error_handler() behaviour that we have today. A couple of specific points that jumped at out me on my first skim: 1. I know Python has BaseException, but it feels a little like the exception version of functions with the name "real" in them. :) If this was $next_major material, then we could probably look at keeping Exception as the top level and inserting a UserException under it that userland exceptions derive from. (Or just not do it at all.) 2. Again, if this is $next_major material, I wouldn't selectively convert errors to exceptions as the "policy changes" section suggests =E2=80=94 let's do them all and be done with it, and the only things that would still be errors are genuinely uncatchable things that already can't be handled by set_error_handler(). There's probably a broader discussion here around whether we should be starting to think about a new major release and what that would look like, but that's definitely not for this thread! Adam