Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118121 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78022 invoked from network); 29 Jun 2022 13:51:42 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Jun 2022 13:51:42 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 060121804BD for ; Wed, 29 Jun 2022 08:42:59 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 29 Jun 2022 08:42:58 -0700 (PDT) Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-2ef5380669cso151918377b3.9 for ; Wed, 29 Jun 2022 08:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=olGEQqInbrrXfR7M4Iuwu0qXQUI+lOybxz/mwWHXdrM=; b=TW08tDNRK6ZcChRnAxO2cWufL1Jx7xMGxhCsB/MZGfydMwoQKGS/CcJ31tyTe/lseA zgBbtrRcP5BQ7CSEGSeijFMXB6WjrA8vHj08ffF7tUSiT21e9/4Nc8xPyRwycnqla6bp VA8KB/SKBm1mMkPIeBaq0+0J01/F0PBzS+diNcVqZYpAXIkzCBliJDp09jho4xnO9i1i d21odOzGe6T1SsJ4G5zPvmwgFPKuXjQniJBAIkptW1aZLhLHlQSkRp4rV0i3yXK1ktcc M1b3IQku+gFgXGWmldNO6fis+m/XHWd2VJMQoMU5NDtt+yW76IOjXMX7UfDyENkthlyA TS6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=olGEQqInbrrXfR7M4Iuwu0qXQUI+lOybxz/mwWHXdrM=; b=0hpPQ5u2fIkZK4f9AMRABTP4wkUl0DdHJfddwOwKTJxVVOZrvDz0rT3gCfOGvDD5Uq Htj88o8EMi2cGfYKITbTMhQke3nZnurUBdAIYZ+DEvApIJqAYK87FgTv4jM6K41AHuH2 JYVMYwWG06yyCn+kQi2w/1VMZ0AQIMAiJ1ROxdFsRP1fPkPmHsCbmhQpMB0ZDnl1ejbW cKCyJ1hORdLKSJLN7WR55Fk+Ozqg0iZWeR0XFGC/Slmqd3A5Qw84AiKnRFpKMGke+dGD xRVO1LI3ooyZHGJ3yJRSrSNaNCEj1HaUNQLFL1yOmEo5Jm95hO3JQ40w/+nNNl9RF2YY LN6Q== X-Gm-Message-State: AJIora9KFFUhL/1Tv5w1ZiX2eX8tXOuXR3+nudh1EalRejcpbaHpgGGr YnQZqy7F76R5KVpRnxbVxwICPdcbchB+xaM+BA== X-Google-Smtp-Source: AGRyM1vbCvAzrK7DCWbsLn++mfS3kNk7IGPY2qUKCsCqX1znTIUYjRkOJK+8GvhJ4sWfEizgqor2tiBxcDLVK+dXZlU= X-Received: by 2002:a81:1d43:0:b0:318:638d:2ca with SMTP id d64-20020a811d43000000b00318638d02camr4764904ywd.135.1656517378050; Wed, 29 Jun 2022 08:42:58 -0700 (PDT) MIME-Version: 1.0 References: <982FFD13-6B2C-4A28-8091-886F2F637B86@me.com> In-Reply-To: <982FFD13-6B2C-4A28-8091-886F2F637B86@me.com> Date: Wed, 29 Jun 2022 17:42:46 +0200 Message-ID: To: Antoine MAKDESSI Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Exception type hint From: guilliam.xavier@gmail.com (Guilliam Xavier) Hi (note: your message was flagged as spam), > https://github.com/php/php-src/issues/8843 So I understand it as having a "true code" equivalent for the `@throws` phpDoc comment (similar to type declarations for `@param` and `@return`)? which would also be checked at run-time? Just my 2 cents on that (let's call it "exception specification"): 1. IMHO, it shouldn't be mixed in the return type declaration (with a union-like syntax) but separated and independent (e.g. with a `throws` keyword, and pipes [or commas] between multiple exception classes) 2. AFAIK, Java has it (mandatory to compile for "checked exceptions", sometimes controversial), C++ used to have it (runtime-checked) but dropped it (and introduced `noexcept` instead); I don't know of any dynamic language that has it You would also need to define how it plays with inheritance (and reflection), and what exactly should happen when a function throws an exception it didn't "declare"... PS: I also found some old feature requests: - https://externals.io/message/4424 - https://bugs.php.net/bug.php?id=42251 - https://bugs.php.net/bug.php?id=62404 - https://bugs.php.net/bug.php?id=67312 Regards, -- Guilliam Xavier