Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113922 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96239 invoked from network); 1 Apr 2021 19:05:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Apr 2021 19:05:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5F80C1804D0 for ; Thu, 1 Apr 2021 12:03:06 -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=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 12:03:05 -0700 (PDT) Received: by mail-il1-f177.google.com with SMTP id u2so2959127ilk.1 for ; Thu, 01 Apr 2021 12:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirtes.cz; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W4yHiXALIwRNDcGWBpt8Ylr1IltVkZ9UruvgWjbucBU=; b=p/hbVrmQSOIXv3KOZ1Gr0rOUHpROCpHoA9BOvGwQoHxf84LwbJF+UAd3tM0wbt1aL6 +aThhsEeEK5dIQjR727LhIKI9FO9fxZAS1OxBbdt/lbwSfTMv/mtZl7DowR65CGkEHs+ N3BssDYSqUpOzdifYpSQsxyWeUKuxC4fCfFnY= 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=W4yHiXALIwRNDcGWBpt8Ylr1IltVkZ9UruvgWjbucBU=; b=htsCTBbBLC10H2Wf8q669ZrLsYxBCl8wbuLZKp3lY6WERhu/4f1lSu6+lqDMY5gweI 9xfIbASUh5ksOm9LhEeXPaLbcWz2XW5ShDi2CFuGsR7DCy8R0d9M0gNjjth6W/CZsT50 GtyZ1TpTp6deRnPMMZN+kosjnLd/GAXop+93Zzt5CHjI7w6LLMe2N4S2q/ZjzSLEtQyN ubWBJBWduDXf4CGW9vvVNjzA0hXJLhVy44GdqF0P7FGG0OXuNIV1c3TQxv0E2QowHdAw CLsjf6NSVN7+FTPpBNwj776KPNp4t5QeI9VuWeg/39WiJ9gQoq1B7cFhI5HxBWd0KCGa +3PA== X-Gm-Message-State: AOAM532VABmBvPMNd7mdL0QanDDTBgDMeuy5VpPl/n4q8hd1t60NC561 aFonFLU+gGeJBwoO2L4ZInAzYdE9I0wuzBFkpvh09g== X-Google-Smtp-Source: ABdhPJyjBOghnyT3fpFTt/L/44VC9stSeCnd/xI7zGlkIkSe8gR2UuBV4p9J/QTO3yeZZ+4DCgKe0kEDgSLQUH14ISo= X-Received: by 2002:a92:6a06:: with SMTP id f6mr7903324ilc.19.1617303784208; Thu, 01 Apr 2021 12:03:04 -0700 (PDT) Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Thu, 1 Apr 2021 12:03:03 -0700 Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Thu, 1 Apr 2021 12:03:02 -0700 Mime-Version: 1.0 (Mimestream 0.14.4) References: <7399011c-a638-5363-5303-c01ac402bb92@gmx.net> In-Reply-To: Date: Thu, 1 Apr 2021 12:03:03 -0700 Message-ID: To: Bruce Weirdan Cc: Andreas Leathley , PHP Internals , Benjamin Eberlei Content-Type: multipart/alternative; boundary="0000000000008d54ca05beede12e" Subject: Re: [PHP-DEV] [VOTE] noreturn type From: ondrej@mirtes.cz (=?UTF-8?Q?Ond=C5=99ej_Mirtes?=) --0000000000008d54ca05beede12e Content-Type: text/plain; charset="UTF-8" On 1. 4. 2021 19:24:35, Bruce Weirdan wrote: > Since `throw` is an expression (since PHP 8.0, > https://wiki.php.net/rfc/throw_expression), it must have a type for its > result, > as any expression has a type. And it's result is exactly `noreturn` (or > `never`, as this option seems to be preferred > judging by current vote results), because `throw` never returns. > > It's quite natural to extend that to function calls that never return as > well. And then it makes sense to declare that type > as a part of function signature like you can do with other types. > > -- > Best regards, > Bruce Weirdan mailto: > weirdan@gmail.com > Yes, this works very well in the typesystem. For example if we define the type of the match expression as a union of all its arms, then the arm that always throws or contains exit() has the noreturn/never type, which is thrown away in a union (int|string|never can be normalized to int|string). --0000000000008d54ca05beede12e--