Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112425 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 92872 invoked from network); 5 Dec 2020 15:14:41 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Dec 2020 15:14:41 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 724CC180511 for ; Sat, 5 Dec 2020 06:43:07 -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=-1.2 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (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 ; Sat, 5 Dec 2020 06:43:06 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id AFFD67BC for ; Sat, 5 Dec 2020 09:43:05 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute4.internal (MEProxy); Sat, 05 Dec 2020 09:43:05 -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=fXndqTNp4IJFqMjNeL6rKQQaUNtNA0YOK0qHxndEl 9U=; b=Bs4P8Zxf0BDr45jvvZbmmxRA5l2lap7AWVbQ0PJsH7NXIBOHFc1xX28W7 qT15A/R7tlKHPjyY88iFWEdhm/4htFfmmQ6u6VvxJ5B2llwn1K3YEfxl+io0vLJS mfO2wLnyqnfeRCql73xdurR7FiIBclbV3gHt2v1O8OudKmrbQca787Pv1Ij+rizq A4FeDugwwit8nyBo9mR/XfmBBq1SwlkLRKg5pDS+NIMuIEpPxdOfbEFYnWad3QjJ ltSyKooi9pHDAWdlZJlUBt1bn4/q/mTskbGFH3zhbACmHitb/pfix/UOXprexXYy 7Fio5Zz7WL2pvxE9fPFP5PMN761vw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudejtddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgeeghefgteejheeggfeghfelueeggfdtjeeivedv tefhveeguedufeelhedvteeinecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhf ihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 0813814200A2; Sat, 5 Dec 2020 09:43:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-622-g4a97c0b-fm-20201115.001-g4a97c0b3 Mime-Version: 1.0 Message-ID: In-Reply-To: <3c47b09a-5678-5a27-f482-114d0469cf4d@processus.org> References: <3c47b09a-5678-5a27-f482-114d0469cf4d@processus.org> Date: Sat, 05 Dec 2020 08:42:44 -0600 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Enumerations From: larry@garfieldtech.com ("Larry Garfield") On Sat, Dec 5, 2020, at 3:26 AM, Pierre R. wrote: > Le 05/12/2020 =C3=A0 00:24, Larry Garfield a =C3=A9crit=C2=A0: > > Greetings, denizens of Internals! > > > > Ilija Tovilo and I have been working for the last few months on addi= ng support for enumerations and algebraic data types to PHP. This is a = not-small task, so we've broken it up into several stages. The first st= age, unit enumerations, are just about ready for public review and discu= ssion. > > > > The overarching plan (for context, NOT the thing to comment on right= now) is here: https://wiki.php.net/rfc/adts > > > > The first step, for unit enumerations, is here: > > > > https://wiki.php.net/rfc/enumerations > > > > There's still a few bits we're sorting out and the implementation is= mostly done, but not 100% complete. Still, it's far enough along to st= art a discussion on and get broader feedback on the outstanding nits. > > > > I should note that while the design has been collaborative, credit f= or the implementation goes entirely to Ilija. Blame for any typos in th= e RFC itself go entirely to me. > > > > *dons flame-retardant suit* > > > Another question, about match() behavior: >=20 > > This usage requires no modification of |match|. It is a natural=20 > implication of the current functionality. >=20 > May be this could be the time to have a "strict match", using enums, w= e=20 > can "statically" guess if branches are missing (of course, whenever yo= u=20 > use default it valid to miss branches) - one thing I'd love is PHP to=20= > throw a fatal error when compiling a match expression whose missing=20= > branches, and not wait until runtime to fail. I think that would make a great follow-up, but it's out of scope for now= . Having match statically know what the available types are when the va= riable type isn't yet known (because it's in another file) is... I don't= know how to do that. That's a broad problem across PHP, frankly. If w= e can figure out a way to do so, I'd support adding it in the future. (= I can't speak for Ilija, but I suspect he would be on board as well.) --Larry Garfield