Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113452 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5277 invoked from network); 10 Mar 2021 19:56:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Mar 2021 19:56:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CA6291804DD for ; Wed, 10 Mar 2021 11:48:33 -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=-2.1 required=5.0 tests=BAYES_00,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-vk1-f182.google.com (mail-vk1-f182.google.com [209.85.221.182]) (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 ; Wed, 10 Mar 2021 11:48:33 -0800 (PST) Received: by mail-vk1-f182.google.com with SMTP id g68so51036vkb.1 for ; Wed, 10 Mar 2021 11:48:33 -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=RJZJ8LDg8UnUG1nuDS5+0tJvOvtB6kEVPr46oHRMmew=; b=HbOTKyK3S0+ZQtUWBdexEhpUiZnAcG7oYnFKVn1KPaV9sKgEbA+Biyji7aeihnBFsx FHqAmJRdIVK/siVmD9H5Hb2yyXZ//89Ij4OBR+DBkI5YqxB1QMC3VCfziOPod2lZ+/KU Vq0V4cCfL7O51UVVzT7Jm2agt9BndduE+NuRjdSbiJ+q6pdfetE9OpqGkUBPIFqwXkDc EpOzbXFomJqokhayrOvGhncORbHjjH6e7D1npcwVuokoFU6UKfp827VJuvkBeF3GUVaM K4sXejQ1qKtdJ214ZvO0A4FIJqjnJdT4OTMNzaM04rjFmdtgoS9vIQ8FVivuOM7rTEej 3/nQ== 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=RJZJ8LDg8UnUG1nuDS5+0tJvOvtB6kEVPr46oHRMmew=; b=eAw3j/pb9yhkkN99yVAbg8w5aIXKL8fKUslWVkrGvhIHJBcv3n22Cb7ly9F3gsit8f M56q7cmi/RTzPh7mI3nvSm3anpARFODkmYZTD9W7uRSawXPNRBm56qAMsoSxTvFypcjn EvygIqTvwOffny/9wxQ46rY2H9hP0l0J4lGoap6h7Sx429KyYLg/RKf4pOpzFh8AGmE/ HU9TdtWek6IiOpKjLr16i2j7o7uZtBXeMOl8aNW5AfxiN7zf+Dlc+IRZQYzY3DgPKzoB niTPk7gRIW+NRwQppQP7sp6xuHkk1EdUJdhJ7XAmL4Qufc43DZkzujNB0cYxGWyu8Wrk p3xg== X-Gm-Message-State: AOAM532jYUzVEeFSY1bC6U3W0Wj0+69ONpfeAz6ojUh22UbKA0Xny3hN 1GAidGtISF5P0p/Y7MHhUhw4112mh5Od7Wlf7KA= X-Google-Smtp-Source: ABdhPJwp69BvNqQJuv1JS47xx0fipOcWlIWF0875TkT2LlXA+vysFEk0UwVLLF6Tzx1CM6xC7Qk/AQm20RaqAPhH42k= X-Received: by 2002:a1f:db41:: with SMTP id s62mr2992122vkg.4.1615405710905; Wed, 10 Mar 2021 11:48:30 -0800 (PST) MIME-Version: 1.0 References: <75a8a0ec-d988-7712-58b5-88c8061db605@gmail.com> In-Reply-To: Date: Wed, 10 Mar 2021 14:48:19 -0500 Message-ID: To: Matthew Brown Cc: Rowan Tommins , Internals Content-Type: multipart/alternative; boundary="0000000000009114d405bd33f3e9" Subject: Re: [PHP-DEV] [RFC] noreturn type From: chasepeeler@gmail.com (Chase Peeler) --0000000000009114d405bd33f3e9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 10, 2021 at 2:22 PM Matthew Brown wrote: > On Wed, 10 Mar 2021 at 13:55, Rowan Tommins > wrote: > > > I am however slightly confused by what exactly the implementation > > checks, and when. Is it actually looking for "exit" and "throw" > statements? > > > > No. Any function annotated with `: noreturn` causes the engine to insert > a ZEND_VERIFY_NORETURN_TYPE op at the end of the function's operands. > > If the Zend engine hits that operand =E2=80=94 which only happens if a th= row/exit > *hasn't* been encountered =E2=80=94 it emits a TypeError. > > The other thing I'd like to mention is that PHP's implementation of > > "void" consists mostly of checking that there is no return statement, s= o > > a separate keyword of "noreturn" may well cause confusion. I would > > personally prefer the name "never" for this reason. > > > > If a significant number agree I can add a secondary vote on noreturn vs > never, but never introduces more of a BC risk. > > I think the difference between void and noreturn is pretty clear, but, if never is more clear, perhaps neverreturn would be an option that would be less likely to have BC risks. Just to throw out some additional ideas, why not two possible types: throws and exits? Don't have any strong opinions on that, but figured I'd add it to the discussion. > Best wishes, > > Matt > --=20 Chase Peeler chasepeeler@gmail.com --0000000000009114d405bd33f3e9--