Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70557 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46260 invoked from network); 9 Dec 2013 16:41:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Dec 2013 16:41:28 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.54 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.54 mail-oa0-f54.google.com Received: from [209.85.219.54] ([209.85.219.54:63623] helo=mail-oa0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B2/41-40251-7B2F5A25 for ; Mon, 09 Dec 2013 11:41:27 -0500 Received: by mail-oa0-f54.google.com with SMTP id h16so4124674oag.41 for ; Mon, 09 Dec 2013 08:41:24 -0800 (PST) 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=w0r//FyL1wTZkcHWqEnsFA7MmsEOpFBVDcr1lJ5H92Q=; b=TUY9L8QdHC6DsJ87PCt5O5tgcHsLPG5/EBbiYNiCkijB5LE/k6lhD1TJAlBKcF+sUx ZejLOBvZ/mdZtfe85QoochuKqTLqcyOGQb2Ft1yGxE2TmLj41kZBdRXMcEk2F1pbUbli NAJwBP65plJ9nG2nDLQM4prDJPY32+rY8vOgIrxCY+OP4uHzXwwjylPTr5sL4yTIbJE/ wtwFsxP3LgABIYkfbjJORorhMEtOiqMRHS21BwlXB8hqTmmnT68yaVB0wjCBTdAqYyLO uDlGiy7KHhvNl6Cb7LXplvVpd0LBO4d71ct3BhcVxz9Ji5ateyf+UJp8Rz8foYKtPjY4 F9zw== MIME-Version: 1.0 X-Received: by 10.60.45.65 with SMTP id k1mr3283719oem.48.1386607284157; Mon, 09 Dec 2013 08:41:24 -0800 (PST) Received: by 10.182.54.112 with HTTP; Mon, 9 Dec 2013 08:41:23 -0800 (PST) In-Reply-To: <6dc040b1d4917ab616951694d3f37575@mail.gmail.com> References: <6dc040b1d4917ab616951694d3f37575@mail.gmail.com> Date: Mon, 9 Dec 2013 17:41:23 +0100 Message-ID: To: Zeev Suraski Cc: Philip Sturgeon , PHP internals Content-Type: multipart/alternative; boundary=089e0141a79c9db78504ed1caaaa Subject: Re: [PHP-DEV] [VOTE] Allowing use of exceptions in the engine From: nikita.ppv@gmail.com (Nikita Popov) --089e0141a79c9db78504ed1caaaa Content-Type: text/plain; charset=ISO-8859-1 On Mon, Dec 9, 2013 at 5:22 PM, Zeev Suraski wrote: > For me it is an argument. Instead of being able to handle these errors in > the same way they handle all other errors, now they have to learn new > syntax and concepts. I see no reason to change the status quo, which > allows those who want exceptions to easily convert errors to thrown > exceptions, into a state where those who don't want to use exceptions are > forced to use them. Again, it's entirely fair that we disagree... > You can't convert fatal errors to exceptions using an error handler. That's why I'm targeting fatal errors here and not all errors in general. While I'm not a big fan of PHP's error system in general, it's easy enough to turn warnings or notices into exceptions via error handlers. But for fatal errors that's just not possible. To achieve what I want it would be enough to turn fatal errors into recoverable fatal errors, that would already allow the error handler approach. But that's a lot harder to do (and imho less usable) than directly using exceptions. Keeping the engine stable after an exceptions is relatively simple, the same can't be said about recoverable fatals. Regarding the "forcing OO concepts": As Philip pointed out, unless you already make use of try/catch a fatal error and an uncaught exception are about the same to the end user - actually, an uncaught exception is just a special fatal error. I could totally understand your concerns - if this discussion weren't about fatal errors. E.g. changing a warning to an exception would cause lots of issues. The @ operator would stop working and people would be forced to use try/catch. But for fatals @ never worked in the first place. You can't handle them right now. Changing them to exceptions adds the ability to handle them via try/catch, but of course you don't need to do them. You can let them bubble (and in most cases that's what you should do) and let them effectively act the same way as a fatal error currently does, just with a bit of a different message ;) Thanks, Nikita --089e0141a79c9db78504ed1caaaa--