Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113904 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 44921 invoked from network); 1 Apr 2021 13:00:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Apr 2021 13:00:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9E2F61804D8 for ; Thu, 1 Apr 2021 05:58:42 -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,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-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) (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, 1 Apr 2021 05:58:42 -0700 (PDT) Received: by mail-ua1-f52.google.com with SMTP id u11so482842uaw.2 for ; Thu, 01 Apr 2021 05:58:42 -0700 (PDT) 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=vl/YDJVzUTy24JJdOhrMKnPnDtlNnTbf3RKLd+GDj5g=; b=mlbnBIAbDGtwtxRmS8GoetqxqBd8S/GmZPlJ9hbTStI7RbePNvXj+KIdt8oN9VvYan JYu9xwQmJzvsnqw6UKmKXOibHllsifJm6aH/b0cAw01XKcqsixT8ojP5u3YtxbyWvD7Q 6gQr4HXm+p5noI6Wg8lTIOQWyVzHi6jaCgKTPXAfOd0rQDO3ZYAFPscMB97gXQ3GjI6g dxtDcD24QqtbWUEEmFeNyJ1YjCGVnrK/9epK3qzYkQbLtBaCny2RJtt3WTWSllWqYLss WMnHprW0yf9+RaH7IfHRCpf2YKTHOT/w/ybegFmyDgEFlda/8a82lZqd2zBdbzdtKeZh iIDg== 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=vl/YDJVzUTy24JJdOhrMKnPnDtlNnTbf3RKLd+GDj5g=; b=MjolRKSM6whmsAedB9B7ICUB3FZjPCF6Ck69buG9zSSSWajy8pYH9ln47GmcG24Gnj UxjgMOVaPy+j8XzHJSJfZojm35bHYVgvyat5LLGiF9gw8AnC9exw402x2nIJx4ECSfYz 1GOHu31Inqllu+UOQneBiOpSdoq36V6XavbSald27RVRFhw4gjKJeIJJKfXtAsDAn0lb 3XvMITaJFeUqJG/EgTm8jKUcJxHtgCapqQVE0oWX06HIAtuwHDw9XnOkX1uzwF6epy8D HKcMgmzqZ6GfJoTDMayscwyUgcqbuSNI6ZLtMlgpjBQeiL0yRXww4/am9YNjzVDLD6R8 Izrg== X-Gm-Message-State: AOAM530DizoRDPE0pJWRRtrxG/SfNCj7QYeublAUbDMdQDLIFEEHHMNE WcLllUvycCRyiFRiIVmxmHO3bxoGkUX0cI2BcD0= X-Google-Smtp-Source: ABdhPJyufVBW1o9+W375Nuh0J3yKWVH7UVNYbswwUR5akUP4sdQ/VLkusS+R9WyNSBhyxjCqsX144uP23wQkznGhaW4= X-Received: by 2002:ab0:44c3:: with SMTP id n61mr4438936uan.47.1617281920809; Thu, 01 Apr 2021 05:58:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 1 Apr 2021 08:58:29 -0400 Message-ID: To: Benjamin Eberlei Cc: Internals Content-Type: multipart/alternative; boundary="000000000000643e2705bee8ca57" Subject: Re: [PHP-DEV] [VOTE] noreturn type From: matthewmatthew@gmail.com (Matthew Brown) --000000000000643e2705bee8ca57 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 1 Apr 2021 at 04:56, Benjamin Eberlei wrote: > This RFC is using the declaration of the return type, to specify that it > never returns. As such noreturn or never is a keyword a long the lines of > public or final, but it is not a return type. > > I don't think the argument for potential optimizations in Opcache to > eliminate dead code or allow IDEs to hint at dead code are valuable enoug= h > to justify this change. > By this argument "void" should also be an attribute =E2=80=93 there's no re= ason to hint a value that's not being returned. You'd write functions like [\Void] function foo() { ... } But we don't do that, because the wider programming language community has agreed that "void" is a type, and at compile-time PHP's engine can ensure that "void" functions do not return a value. "Noreturn"/"never" is also recognised as a type by the wider programming language community. It can be checked at both compile-time and run-time by the engine, as detailed in the RFC. Indeed, _no other return type makes sense in the context_. The type definitely felt awkward when I first started using it in docblocks, but after a while it started to make intuitive sense. Best wishes, Matt/Ondrej --000000000000643e2705bee8ca57--