Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113407 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 249 invoked from network); 6 Mar 2021 15:39:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Mar 2021 15:39:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 363821804B8 for ; Sat, 6 Mar 2021 07:30:36 -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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 07:30:35 -0800 (PST) Received: by mail-ej1-f48.google.com with SMTP id ci14so10020396ejc.7 for ; Sat, 06 Mar 2021 07:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SHeA6PE4V05MCjtwgxwBDKX/VKQj700HTQ8RCcovCPM=; b=Y7hj253wRxRs9x4UTfV8t2wQiH4QSdcsNlU1qcDlOErrOecZvh6NpJWu/2KIp6QVQV 5W57opLdjJ8w9QJ0S4FjGdcTW1n8p2+aO9kgEDhCY/HDnkafYCnHkAsLiD/PbUQkXUgz QSal6nTrRxjm8vw/cWvhZ2Qn3sGDTjlVHbNdr2K1K3o3M6oPX/0JxWW4jo65EHP0SDxJ +cOEeh97478luFQ+/57SiYwemUqey2eNRjyWpmkInvAUr28BgAYaEcsfCyh+43Yz7wbE G+iqZcOmH86jIoX9l1JLQoIAgTMvVPzeOB/KHSog1jLc8l9Rqwetw+Sgql43Uj+Q0O5i CAXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SHeA6PE4V05MCjtwgxwBDKX/VKQj700HTQ8RCcovCPM=; b=nTI94soG2SrRC6El6mrUU3CkUHv93ZK7zMud35Q+6OGswfqtzuJgw3YkmYmVHYjJkZ zU8Z7K7r+TSCbowhTCOimy7gho6ICYHEHF8UdEEo8zYxRjYLzkq9DH8my2uL4MGy1O2m Zfy0EnZj9DQNJXLLdRwKkcLIpQNf8DPi2j/r1kGfoC332FBxosfTL/WX0sLv2ka1gMKy ziftU3D0m45IjSdQjCVe+bTaFJjFDpnO117oeoBm04BWoiH9f4e45vK/hsOAHoUfEYgh PLso0C1iF/gmIFP8Q+P5laVSBDiHdF5gBRR11udkEo5jNaL+cKDVWQMV1gN+RJMgkFV4 IXPA== X-Gm-Message-State: AOAM533tHBmpsTk4mmR5H4YJNSUOCCHx3E+XS5YYYKF/h+awqDTsrPDG jyokJP45Aze0Hf225hWdn3SyZxWdFDMTz2j+BxmcOV9nl8Q= X-Google-Smtp-Source: ABdhPJy/f/r35VeOZk8QeZE3cH0sVC/hzSz8HfoTDICQytZQDv32PILFP+7qH6ArziC6FGBuKuT+Omus7VvgDDcw5ew= X-Received: by 2002:a17:906:3856:: with SMTP id w22mr7295903ejc.77.1615044631983; Sat, 06 Mar 2021 07:30:31 -0800 (PST) MIME-Version: 1.0 References: <7D86BD2A-3D54-41A1-8BAE-2E65AB155271@newclarity.net> In-Reply-To: <7D86BD2A-3D54-41A1-8BAE-2E65AB155271@newclarity.net> Date: Sat, 6 Mar 2021 15:30:20 +0000 Message-ID: To: Mike Schinkel Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000095fa7505bcdfe18f" Subject: Re: [PHP-DEV] [RFC] Extend error control operator to suppress exceptions From: george.banyard@gmail.com ("G. P. B.") --00000000000095fa7505bcdfe18f Content-Type: text/plain; charset="UTF-8" As Rowan has addressed your first points, I'll skip them but will add a code example to clarify in the RFC. 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. > > Would you also consider adding a reciprocal `error_on_exception` declare? > 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. 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. > 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? > > 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. Best regards, George P. Banyard --00000000000095fa7505bcdfe18f--