Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113619 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85204 invoked from network); 19 Mar 2021 14:58:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Mar 2021 14:58:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D77A21804D8 for ; Fri, 19 Mar 2021 07:53:11 -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-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 ; Fri, 19 Mar 2021 07:53:11 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id 75so10417353lfa.2 for ; Fri, 19 Mar 2021 07:53:11 -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=Ej3gXqfn7Itfkk2Ny5E2eiSVN1Ky2scy8quPif5edpw=; b=WSpM3DAqgV2hzbYU2Wn0UBsrl1MEi20qC2j2RIuP48CJs8v8jwf5AgWck83aoKIE4q aWeGtWLkMSoWSiYv9AxqCjfyb1ua5a8YFS2V48bMrcqPeEuSoh2FkfhGiaJhQOtpGRgW +SRD/uIQm3Bjg00lUZjCkeuxENG+6dXkwieK0eyCSEf95/10T1V9MqHeUJlW8to0TKrP O84NhmBnHdMDRxwGOMKuxRwxP7ThWifSuuwnVCTJQhdFBzNPzHFdypVX3jszdE4gO6up O2bPLvyGV/l4S/+U0DSWySEtXY/Q8Ntsjh9ykdOX9Wn3CrOqd6y4Xs5L5mqBWmL1PmlQ CYwQ== 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=Ej3gXqfn7Itfkk2Ny5E2eiSVN1Ky2scy8quPif5edpw=; b=TCFRtuifMBTwFOkVxsoH54Z+HJYmT7jdjzVAwnEslN+AZiRfw/+0jn/+aRuGXSw8vO awR0bUM3gdo3248OlG+5OvNJdaxWq3id9cMSUhPRWwcvkCwjjSPuHoN9MeBiM3BlZBLc hfA1ZrZjsPm3f27OoQK4fbmMRpxo0U2KCjVwzvgU775wT/nFVZU16Dbb9E9kvPPYRIUI FXfwnU2KCyXLtCLsFCcAfNlYWMKP1stITxovhjj3727+Z9COy8TZhokSTndRETDOONV8 fBGRJu55VbAXpshVAeE4peEI/ECjPJgj9gMTqz42NdBJo2XKNXzND20PMhBoAq10tGP1 PFKg== X-Gm-Message-State: AOAM532sqZKrhJYapObKbhKkbXPKqlY3PwY/w1Fj5OK39t8PP4n4z1bh qNrCcWWChdONPh7rrsbnKPs74PrxFoWTaYqKbXQ= X-Google-Smtp-Source: ABdhPJzjEFqZtc4sEQ1YYKYkOYI/gl/taTe1MtF1YQRQu9XPc8XsTiIm670tiGRPxjuEwsrOz4vn2J1V0LgD5Ay17YY= X-Received: by 2002:a05:6512:1155:: with SMTP id m21mr1123952lfg.44.1616165590185; Fri, 19 Mar 2021 07:53:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 19 Mar 2021 15:52:54 +0100 Message-ID: To: Marco Pivetta Cc: Matthew Brown , Internals Content-Type: multipart/alternative; boundary="000000000000e6b8da05bde4df31" Subject: Re: [PHP-DEV] [RFC] noreturn type From: nikita.ppv@gmail.com (Nikita Popov) --000000000000e6b8da05bde4df31 Content-Type: text/plain; charset="UTF-8" On Fri, Mar 19, 2021 at 3:45 PM Marco Pivetta wrote: > Hey Nikita, > > On Fri, Mar 19, 2021, 14:35 Nikita Popov wrote: > >> >> Is it allowed to declare a noreturn function that returns by reference? >> >> function &foo(): noreturn {} >> > > Given that `noreturn` means it should throw, loop forever or exit, how > would a by-ref usage be applied/useful? > > Or is it a hint at a missing test? > Mainly a hint for missing spec ;) Context is that we're considering to deprecate by-ref void return ( https://wiki.php.net/rfc/deprecations_php_8_1#return_by_reference_with_void_type), so it would make sense to me to prohibit this for noreturn from the start. However, I could also see an argument for why allowing it may be useful due to variance considerations. It would allow you to write something like this: