Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113411 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24655 invoked from network); 6 Mar 2021 20:49:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Mar 2021 20:49:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C77CD1804B8 for ; Sat, 6 Mar 2021 12:40:50 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 6 Mar 2021 12:40:50 -0800 (PST) Received: by mail-qk1-f193.google.com with SMTP id z128so5596198qkc.12 for ; Sat, 06 Mar 2021 12:40:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=HQ5F0fD7O8mVbMxlexAkoj+a+ODdGLxTMvZ0CbhNnjI=; b=EPKZGkjCq3fHWIl4SSZ+K+ZugIrYSPKLO5K+qQeLPLOMdlhnv2bh3EJABbpmFnSmoe N7YRY9lCJWUCbejnlvoIbQDdFW3AlXUoq/YAJ3YzVD1hga3u8VzYSRsnqHTSZWxXps5s rJodPd1rqMQfZKlRRR94rFWZ+Y6dIKBdsZTk0UgDQ1JuBDHh86iQilWZ/zh3AlkX26we pUXEL4vP+vRd7nKOMZRJl1oFC4fbCAIFGA5BjR2nKdX67BPC4BOuRpf9RtViOuth8rzI 8jmOFSy1ZMpey0Id4v1kMGDve1JM6LJoOrhX9/lH90sEttphi12FfWKIssKG12IvRfOB JOkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=HQ5F0fD7O8mVbMxlexAkoj+a+ODdGLxTMvZ0CbhNnjI=; b=BkT6mKqpadfXm1CZ05RuhYQlZ75d1swJcbNE837KhM4WFnp4cpl4RkaV4sGfLkqfrg zgSkKWow1hxIiBPHhrBeOk15h1cQpZeHcqn0VEUMX0O40qYNjFXPXUbDkhhQQxG9O3YU xm1yZPnfBYG/grIL1qHxiumpNJ4NgpOIMrLA3elY1v3YJMrXZRujChNgqCHwujqNuPMg d9dKuHztMi0OUPJHMcB0TruoC/1sTZyax0JwZQ5ii5TXo6U3972YP9xI5efXdhSL2vww joBF9lTwgWTpeD7Z0CiLvTu2H9GAotCAPAEGJ16GwEMGycDs6Ya+4C0ujVoJXB7V5zwS M95A== X-Gm-Message-State: AOAM5304wLHOW3jAFZiwG9BHHGSRKKiKQRvCBVGARsCRE+cEm7owDNhC hB1zujavXT29OIynN19eagxENQ== X-Google-Smtp-Source: ABdhPJxFZ4TN8tILoRlw1bi4pUu07bgCZ4Ism4L9sjlyDhU1AibTPlVl/2uytCnmlLLSuspIeQExcA== X-Received: by 2002:ae9:df46:: with SMTP id t67mr14766690qkf.269.1615063249620; Sat, 06 Mar 2021 12:40:49 -0800 (PST) Received: from [192.168.1.239] (c-24-98-254-8.hsd1.ga.comcast.net. [24.98.254.8]) by smtp.gmail.com with ESMTPSA id r67sm4425196qkd.93.2021.03.06.12.40.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Mar 2021 12:40:49 -0800 (PST) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_6DA8E473-E777-488D-B9FE-F5750BDCC0ED" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Date: Sat, 6 Mar 2021 15:40:48 -0500 In-Reply-To: Cc: PHP internals To: "G. P. B." References: <7D86BD2A-3D54-41A1-8BAE-2E65AB155271@newclarity.net> X-Mailer: Apple Mail (2.3608.120.23.2.4) Subject: Re: [PHP-DEV] [RFC] Extend error control operator to suppress exceptions From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_6DA8E473-E777-488D-B9FE-F5750BDCC0ED Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Mar 6, 2021, at 10:30 AM, G. P. B. = wrote: >=20 > As Rowan has addressed your first points, I'll skip them but will add = a code example to clarify in the RFC. >=20 > On Fri, 5 Mar 2021 at 04:26, Mike Schinkel > wrote: > > This proposal on it's own would not be sufficient to trigger such a = change > > for extensions but in combination with another proposal to introduce = a > > `throw_on_error` declare [2] it could provide a bridge for a gradual > > transition to the use of more exceptions internally. >=20 > Would you also consider adding a reciprocal `error_on_exception` = declare? >=20 > I would not, as diagnostics (I've started to really despise the = wording > error/traditional error for E_NOTICE/E_WARNING and co) can always be = elevated > back to an exception by using a custom error handler.Now in theory the > opposite is also true you can set an exception handler and raise an = E_WARNING, > but this is mostly a useless operation as you're already at the top of = the > execution stack. Thank you for responding to this. However, throwing a traditional error = was not was I was suggesting although in hindsight my choice of declare = name would indicate exactly that. =20 What I was suggesting for have a way to tell all functions that throw = Exceptions to simply return instead. =20 But after further consideration, for that to be useful I realized that = such an approach would require more than just a directive and that is = what I emailed you privately to consider. > Because of that, any time a diagnostic might be emitted the VM needs = to > perform extra checks to see if it wasn't elevated to an exception and = perform > some special care handling.As such a declare which would toggle all = exceptions > to diagnostics is a very bad idea IMHO.Even if this is just limited to > functions/methods and not language constructs, emitting a diagnostic = is usually > subpar as to analyse an error one must do extra steps (reading = error_get_last() > and branching, etc.)It is true that exceptions can be overused/abused, > but they are IMHO far superior to diagnostics.=20 >=20 > > Although I'm not thrilled with the idea of shoving more = functionality into > > @ I don't see any other way, and thus I think it a necessary evil to > > improve the long term health of the PHP project. >=20 > What do you see as the downside of shoving more functionality into @? = Is the concern anything more than making the source for PHP more = complicated to maintain? >=20 >=20 > Other than the BC break I think there is also the fact that the @ = operator > has a "bad" reputation and users went to great lengths to *not* use it = by > utilizing various tricks. And starting now to *promote* the usage of = it again > could be seen as a net negative by many people, especially as being = able to > use it to completely ignore any sort of Throwable error (be it a = subclass > of Error which should probably never be caught and ignored, or a = subclass > of Exception where it usually would make sense) in such an "easy" = manner > could lead to overusing exceptions for dataflow although exceptions > (at least how my PoC is currently implemented) are still expensive to = create > just to be tossed away immediately. Ah, good points. Thanks. Seems like there is a need to be able to say "Don't throw the exception, = just return it to be so I can handle it immediately" but not require a = minimum of five lines of try{}catch{} construct, especially if in this = special case generating the call stack was omitted because it would = clearly not be needed...? -Mike= --Apple-Mail=_6DA8E473-E777-488D-B9FE-F5750BDCC0ED--