Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112552 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53282 invoked from network); 19 Dec 2020 02:16:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Dec 2020 02:16:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B46211804E1 for ; Fri, 18 Dec 2020 17:48:13 -0800 (PST) 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.6 required=5.0 tests=BAYES_00,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 wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 18 Dec 2020 17:48:13 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 1237C91A for ; Fri, 18 Dec 2020 20:48:12 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute4.internal (MEProxy); Fri, 18 Dec 2020 20:48:12 -0500 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=fm1; bh=gopLm9/A+9pL20hxm4epGi7jeoNYmCB9j8wwUZcw6 gk=; b=MGIm7GzwfVBShZey2SYqrtT/RLGf/se/Hg8BH4gYhwJncCVA16HNh21Tk 30V6As4ySCC7Yv9s9tkTuOHatIUBEmQJFiYRyN0uHX66i+WP1lP8GAcUh4UCVpDv dU+bfzoAiLXUqb4JGE3MtMuWuSrK/4LyHG2ZqekxiYvifqzGmu7eY6sqvZieKE8u quc8OAzmJ5WYchtkZj01H8VLsETwf/mnx9A1+vab0DGIGLdqPxpoVfC5ooOQGo0I cxeDVfWOrQOdisRNZVM+VW7yL8/xzvS3hem5JJMOW0r7vT57jR/iLzht1cTM5Gz0 rHgGUzXV1OyQPjAwp4dvSC2KNwYeA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeljedgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgeeghefgteejheeggfeghfelueeggfdtjeeivedv tefhveeguedufeelhedvteeinecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhf ihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 437AC14200A2; Fri, 18 Dec 2020 20:48:11 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.1-61-gb52c239-fm-20201210.001-gb52c2396 Mime-Version: 1.0 Message-ID: <24f119cf-0ab5-4db6-8940-062f08d5a8cb@www.fastmail.com> In-Reply-To: References: <490a62fb-f6f4-4d7b-b46d-571abfa28618@www.fastmail.com> Date: Fri, 18 Dec 2020 19:47:49 -0600 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Short-match From: larry@garfieldtech.com ("Larry Garfield") On Fri, Dec 18, 2020, at 1:40 PM, Olle H=C3=A4rstedt wrote: > What about matching on a variable's type? >=20 > ``` > match { > $var: string =3D> "is a string" > $var: array =3D> "something else" > } > ``` >=20 > This could be used with flow-sensitive typing, e.g. assume the type of= $var > being string in the string block. Psalm works like this for if-stateme= nts. > Also consider the case with generics. >=20 > Compare with generalised algebraic data types in FP (GADT). >=20 > Olle That would be more along the lines of the pattern matching RFC that Ilij= a and I have been kicking around for post-enums: https://wiki.php.net/rf= c/pattern-matching That's still in the "it would be cool if" stage only, and is IMO off top= ic from the abbreviation effort in this RFC. --Larry Garfield