Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112979 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88531 invoked from network); 25 Jan 2021 02:48:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Jan 2021 02:48:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 25D311804CF for ; Sun, 24 Jan 2021 18:29:29 -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=-0.7 required=5.0 tests=BAYES_40,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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 24 Jan 2021 18:29:28 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 29E805C00FD for ; Sun, 24 Jan 2021 21:29:27 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute4.internal (MEProxy); Sun, 24 Jan 2021 21:29:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=ygxyv9 aS1JjmurXFflY2QEyxc93dqdUcuV9PJ+yHZZo=; b=WCODqeJ/Xgrb8oBLSD1yuV klVpeWcCQoVqVGV1Sv0ycyfiPKHpBWqKUe1ww0iCUxOsZhOgkbhGHqOxIR/nvaHS 7Ds4nF9dC6l1IcIQIzkoEc7ZFeUFPNCXZgkwX40aQgBTONOSfqr05x629XAdbkAF LucZtFSoeHNAwH4xQpVUm6nm29Le5Di48Irq2yFTHwMnNNxwfErPalTZMGtmoQ65 YZesGZ0yXU1ABov1ABA0c40Qs6/nWS4mMwRiANUBEf3V242KoifU+XaOsMoW2f+k MGwuXbDOfkceyK8e5LxnEbkIFYxWTdhAa6aJgTFYSqqyE+xn1mEvJKWWkwUdGuJA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddvgdegiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fuuhhsphgvtghtffhomhgrihhnucdlgeelmdenucfjughrpefofgggkfgjfhffhffvufgt sehttdertderredtnecuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoehlrg hrrhihsehgrghrfhhivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhepheff teegudfgtdeuleejudejfeefgedtteejudfggeffffduhfefudevkeeuffdvnecuffhomh grihhnpehphhhprdhnvghtpdhgihhthhhusgdrihhonecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtg hhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id C003914200A2; Sun, 24 Jan 2021 21:29:26 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-78-g36b56e8-fm-20210120.001-g36b56e88 Mime-Version: 1.0 Message-ID: <8f17a7b3-2488-461f-9756-d675b1dc0981@www.fastmail.com> In-Reply-To: References: Date: Sun, 24 Jan 2021 20:29:05 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Enumerations, Round 2 From: larry@garfieldtech.com ("Larry Garfield") On Mon, Dec 28, 2020, at 2:21 PM, Larry Garfield wrote: > Hello, Internalians! > > After considerable discussion and effort, Ilija and I are ready to > offer you round 2 on enumerations. This is in the spirit of the > previous discussion, but based on that discussion a great deal has been > reworked. The main change is that Enumeration Cases are now object > instances of the Enumeration class rather than their own class. Most > of the other changes are knock-on effects of that. > > Of particular note: > > * Cases may not have methods or constants on them. They're just dumb values. > * Enums themselves may have methods, static methods, or constants. > * Traits are supported, as long as they don't have properties. > * The value() method on scalar enums is now a property. > > The full RFC is here, and I recommend reading it again in full given > how much was updated. > > https://wiki.php.net/rfc/enumerations > > The implementation is 98% complete; there's still a few lagging bits in > reflection, and some opcache bugs that Ilija is still stomping on. > > There are a few outstanding questions listed that we would like > feedback on. We're not entirely certain which direction to go with > them, for reasons explained in the RFC. Input on those is especially > welcome. > > Happy New Year. May it be enumerable. For those who would like to play the home game but haven't been able to, Tyson Andre has build a delightful Wasm version of the enums branch so you can run actual code using enums. https://tysonandre.github.io/php-rfc-demo/enums/ 100% credit to Tyson for putting that together. It's quite slick. :-) (It's a few commits behind but nothing that should impact most testing; just some edge formatting around print_r, reflection, and stuff like that.) Also, while we were at it, we went with the from()/tryFrom() method pair. No one seemed morally opposed to them and there wasn't really a better naming convention. Aside from some nitpicking around reflection and possibly fiddling with the naming of "Scalar Enum" et al, we're closing in on the final version. It will probably go to a vote in the not too distant future. --Larry Garfield