Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123327 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 2C5A31A009C for ; Thu, 16 May 2024 22:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1715900399; bh=RzrVxBq/d95+lkAu6g76ravHfGMrVC2X78gpvw2sJR0=; h=In-Reply-To:References:Date:From:To:Subject:From; b=iNNZPyYYdtGrKQfpue8tfGca08D65jDMJhMjFW16bXheV4J6FzM47sFFOjPqAeFPs pxFBcLC6MXOcbkHrZMahU9BnGW00LmO7ZBFyD1ahtELxg66l6qi9EnI3u8PuSPUA0U PKm0fBVsGTCH2UcuEteb0mo+NZBpLQWmwDJR+USLNyqPGcC6p40aI3kdPaHQ+E6I2I bC2l7DnMDfvvt36lhCM96+J5N2Y9E8+fkUnChZ9BZAZp5FtGAiBJkNe2JqOCBTql15 9Tepp5DrSUTkssHOPsbluaF24qEcJEmahwPkniZfPloIeqjgEGygPhOxHVMI/AGxPg b9HGK8x8CMh/Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E511F180057 for ; Thu, 16 May 2024 22:59:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from wfhigh3-smtp.messagingengine.com (wfhigh3-smtp.messagingengine.com [64.147.123.154]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 16 May 2024 22:59:57 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.west.internal (Postfix) with ESMTP id 339F01800134 for ; Thu, 16 May 2024 18:59:03 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Thu, 16 May 2024 18:59:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1715900342; x=1715986742; bh=pO8lRQsavBVwA6M7xbmSd ektwXIb/Kc8dhZfAU1NMrE=; b=5TN4599C4Py294TAPPDCRi3iwion4cpLv8l6Y GCijN+D3D6CJz5usl9NEq5hUfMCERnmMO/Kh0SxtznU1krr+ZSt7ZQOtOfKS0z3O mvFprxQ0U6SS0uL6f+S6AYTDIrrOVLFKIghssM/o2vkOorP1DOjebd2jQj1pxI24 OrGhOSEYsTWNRl3csY4exhTGcRGv5GTJAEKwJQ0f9FlEJVxi8Lr+0RcON9rVbvPJ GHuLZ3y5UtKt0hQOfyrcIkGz4wO0bePufk7Kld2v3qCamEUHARSAtRvEy6hqkt/i 3HE8lWyddBakkaAjidsdaTKmFeP/LKJBInbO6INOWcdKjYKew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1715900342; x= 1715986742; bh=pO8lRQsavBVwA6M7xbmSdektwXIb/Kc8dhZfAU1NMrE=; b=a mWhVRY3NAOvz41bTKVB7AQhRWj0ZYPzmfoj/g3PBmBeYXCe9qFqj9SsvlA6iCqQp FRperK9Rq/jCXkExmWUMDBepntWyqBKQOTIkSnNiuyPRPamfbYCFZLRiDntLC1L1 aEySDWy+AN4dxUWfrGiOESYxzvYWtuI6b4vMooTWVtE2g6l03XfipjKbKN3PJXIE RM+5vIFVoHmS6TYLIPCPC8IsfTiqTjpl4+Bvbcr8NyhjTpCs9a/DNqtHZ0tvWBSw 62B61i3/M7/l8ZtUBU0anRMz4miMxJ0rLghxSRtgNIcFb+ujoIHvxrW/PdP7Hvpm Ui/GZBLhqD//qeBCy3LDw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdehvddgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepffffffejffdugfegvedviedttedvgfejffefffej leefjeetveehgefhhfdvgfelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 574991700093; Thu, 16 May 2024 18:59:02 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-456-gcd147058c-fm-hotfix-20240509.001-g0aad06e4 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: In-Reply-To: <3A6.1T4AB.9eXWvq4hof.1cHcqE@seznam.cz> References: <3A6.1T4AB.9eXWvq4hof.1cHcqE@seznam.cz> Date: Thu, 16 May 2024 17:58:44 -0500 To: "php internals" Subject: Re: [PHP-DEV] [RFC] [Vote] Type Guards for Classes Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Thu, May 16, 2024, at 3:31 PM, Patrik V=C3=A1clavek wrote: > Introduction > ************* > > This RFC proposes a new feature in PHP: type guards for classes (or=20 > interfaces). This feature aims to simplify and standardize the process=20 > of verifying that a variable is an instance of a specific class,=20 > enhancing code readability and reducing boilerplate code. Without commenting on the idea itself, this is just a proposal at the mo= ment. The subject line implies there's a formal RFC now up for a vote, = when there is not even a formal RFC yet. Ie, please don't abuse the sub= ject line incorrectly. :-) To comment on the idea itself, I believe Ilija is correct that using pat= tern matching would be the better approach here. Right now the RFC sugg= ests $foo as would return true or throw, but "return $foo or t= hrow" would indeed make more sense. And then give us the entire power o= f pattern matching. (That RFC will come up formally soon(tm), I swear.) --Larry Garfield