Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113396 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52990 invoked from network); 5 Mar 2021 04:35:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Mar 2021 04:35:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 54D091804D0 for ; Thu, 4 Mar 2021 20:26:27 -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,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.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 ; Thu, 4 Mar 2021 20:26:26 -0800 (PST) Received: by mail-qt1-f193.google.com with SMTP id d11so788342qtx.9 for ; Thu, 04 Mar 2021 20:26:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=UP6RJXnsJSmlTpBPsqT4nCxYih7kYUi1WleQjctA2Ss=; b=1kSTaThxEwI1qhF0dout5E37BI1eDBbwfLLGNe01A6VM+gkIA7p/ge7u2HTqlhraBH 4hNFXkmdKsVIUg4geSjmu0iFMdxaG22+73vHrONQCt3TeEhLsk0cEu/VDKmAE+EuO+xY whSoEXmrOgRDQMritTEO860qI4eZMkKR0eRVbsM97LOKajmw7s8pGhK6FPqlA3oKHrgu vJydN+YmLTzdHr9KBss9N0xbxCi5cpjP22/e4Ry1geSGnpGkne4EDO6+Ej590N7Mgipl 9MwfkaPwh/BxBvUt7PktKONABtUJl48prw0jCPAA9LyucBMc9FUa7eyA+Ewh3n5stllt Z5cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=UP6RJXnsJSmlTpBPsqT4nCxYih7kYUi1WleQjctA2Ss=; b=fYjCYd6Oedv0LMFw547Lj9Z/6Zi3Qt/NjHGHx9y7dy5Dm+X5hqFgQ0xqVuM9TaV7us xiwl5nlspMx1JZLnYJ0Yy8ChGrSYEK2SeI+U93RL0RmyShHcDPpryrCYrICakuTF7gwM tcs/wQW9ucdU7Foc1qfIdvQ5ePR9AhjNfkJKQks8a1jdF7U+93Ptc66DkLYq+nVYIjFG dB6yy4OgF/0lQSgU9jOawS/AY33+XsYog1wpneqmxNzsEDm9+BrsqZKyKvrnL42ymGVu YJU7jz4iHxxacu/wy5A3PKwd/fgXjDWZCFn+Af9754EiMe2uVEbeBh3KqwHsBqRmlI2f 3VNQ== X-Gm-Message-State: AOAM533m9wLNtd6n0dxpzNIbwC2mxBhXDE+1pr3GpyHx5SX3gnOfLZ5q CTznT2fI41gW/iV1Z9vCfzykS5J20JbSiZvo X-Google-Smtp-Source: ABdhPJxph/dhnZYKbiEayhG/cLkp3clXAawUqvwxuVSOO67SmSQA8czznNtr8uB/oTbTBZr8MheMDw== X-Received: by 2002:a05:622a:cf:: with SMTP id p15mr7468020qtw.276.1614918384462; Thu, 04 Mar 2021 20:26:24 -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 k126sm1054830qkb.4.2021.03.04.20.26.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Mar 2021 20:26:23 -0800 (PST) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Date: Thu, 4 Mar 2021 23:26:23 -0500 References: To: PHP internals In-Reply-To: Message-ID: <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) > On Mar 4, 2021, at 9:08 AM, G. P. B. wrote: >=20 > Hello internals, >=20 > This new RFC which I'm proposing is to extend the capability of the = error > control operator @ to not just suppress diagnostic messages but also > exceptions. > It can currently be found on GitHub: [1] > https://github.com/Girgias/error-control-operator-exceptions-rfc Reading it several times, it is still not clear to me what the following = means from the Proposal section: ------------------------- Add the following syntax @ to suppress only the = exceptions within the class list, this is similar to: try { expression }=20 catch (union_class_list) {} As such @<\Throwable>expression and @expression are identical. ------------------------- Specifically: 1. What @ means and what it would look like in = practice,=20 2. What catch(union_class_list) would look like in practice,=20 3. What @<\Throwable>expression means and what it would look like in = practice, and 4. Can you provide a few concrete code examples, please? > The main motivation for this is to provide a path to migrate in a = backwards > compatible manner away from diagnostics such as E_WARNING to the use = of > exceptions without breaking 99% of PHP code which has been written in = the > last 25years. I am not clear what you mean by "providing a path to migrate in a BC = manner" here. Would this require developers to prefix all functions = calls with @ for functions changed in a future version of PHP to throw = exceptions instead of returning values, assuming they do not have the = green light from their stakeholders to make more substantive changes to = their code? =20 IOW, are you proposing a requirement to change existing code but in a = form that could be (almost?) completely automated? Is that the how you = are envisioning this aspect of BC to work? > 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. Would you also consider adding a reciprocal `error_on_exception` = declare? > 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. 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? > Feedback on this RFC and different ideas on how to tackle this topic = are > highly appreciated and welcomed. >=20 > Best regards, >=20 > George P. Banyard >=20 > [1] https://github.com/Girgias/error-control-operator-exceptions-rfc > [2] Draft RFC for throw_on_error declare > https://github.com/Girgias/php-rfc-throw-on-error-declare -Mike