Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113640 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88272 invoked from network); 20 Mar 2021 15:40:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Mar 2021 15:40:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AD155180505 for ; Sat, 20 Mar 2021 08:35:23 -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.7 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (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 ; Sat, 20 Mar 2021 08:35:22 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 7F4FC5C0044 for ; Sat, 20 Mar 2021 11:35:21 -0400 (EDT) Received: from imap8 ([10.202.2.58]) by compute4.internal (MEProxy); Sat, 20 Mar 2021 11:35:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Z8NU1GPxEs+WJ1xqbSGW3WgWhHGbCsgOdE9aut1To 50=; b=FiesdZDoO/GwJhoDYhMaQ61mtWnyj5XIef4IPY5y7tmOgvGHENyMFHEth XZyfyjImWt/DgZ43aqDuUqgKZtHpXO/FPDbmuhiomqaNgM+uJxi2BaokmRb2jmqF EHJoVJIf5YAn5DBKKlENMLXb6Vvvpfh1jW8Qr27sjXDM/s1uPQ2WSPCk2J4nHl5x JL/8EdpGyit/23fviKTqJm+3UMPJ4CC1eqq+ML5AKoEt6OSIb8WKDiKWm23ktr6Q lzrM44T33neu38qaVjma/UM6Bdmzi5w/2WuQ/mhcxsVCetydwajA7Lsnu5cVLFwS 2ODFCR0nmitZ9FiH25WVRmLi9fGKQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegtddgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgeeghefgteejheeggfeghfelueeggfdtjeeivedv tefhveeguedufeelhedvteeinecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhf ihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 244393A0561; Sat, 20 Mar 2021 11:35:21 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-206-g078a48fda5-fm-20210226.001-g078a48fd Mime-Version: 1.0 Message-ID: <96b4b678-6605-4b9b-a493-e4c9adfc11d5@www.fastmail.com> In-Reply-To: References: Date: Sat, 20 Mar 2021 10:35:00 -0500 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] noreturn type From: larry@garfieldtech.com ("Larry Garfield") On Wed, Mar 10, 2021, at 12:06 PM, Matthew Brown wrote: > Hey, >=20 > Ond=C5=99ej Mirtes and I present an RFC for the noreturn type: > https://wiki.php.net/rfc/noreturn_type >=20 > The feature already exists in Hack (the primary inspiration) and is > currently supported by our static analysis tools inside docblocks, and= we > feel there's a good argument for it to be supported by PHP itself. >=20 > Thanks, >=20 > Matt & Ond=C5=99ej My main concern is around the covariance of inheritance. The example gi= ven: abstract class Person { abstract public function hasAgreedToTerms(): bool; } =20 class Kid extends Person { public function hasAgreedToTerms(): noreturn { throw new \Exception('Kids cannot legally agree to terms'); } } While that may be technically correct from a type theory perspective (my= type theory isn't strong enough to say either way), I don't feel like t= hat obeys Liskov. If I have an array of Person objects, and I iterate t= hem to check if they've all agreed to terms, I expect the return value t= o be a *usable* type in the Person interface or a subtype of it *that I = can still use*. I cannot use Kid's return type, because it's by definit= ion non-existent. =20 That feels like a bad time bomb. Other than that concern, I'm fine with the spec. I would marginally pre= fer "never" over "noreturn", but not enough to vote against it just for = that. --Larry Garfield