Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113036 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72925 invoked from network); 1 Feb 2021 13:33:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Feb 2021 13:33:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3037F1804D1 for ; Mon, 1 Feb 2021 05:16:48 -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.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 ; Mon, 1 Feb 2021 05:16:47 -0800 (PST) Received: by mail-lj1-f174.google.com with SMTP id l12so19524443ljc.3 for ; Mon, 01 Feb 2021 05:16:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W2vN7Sl0nXj0yjJCXQhtiDO3o7WDO8ZyDLVhMTeuOOc=; b=FgYaGGB1CdBmJisYM3L3DrK5N6CZ9YbkY0JaN+2L0zo+Xhn23TixqDhbsBuh0GQP/m IfmoMwyEz6Jj8VqJrHqmYa/zVLRIgGWl5sEGTbR+pvrG0m4a2Uy+wWWgjIHxQvTNrFfM fsPJGJwOhlGbw84iLfVdxtVd+DQypMCiYT5bmT6V2wyE1jo903alvBHcShL7h9dkGqab 76GEUr7ofocQ4yorC4Smkni+oXM3/TqdhtCdVscQErCQbVp/nbWi4AJgIos7F/2eR9mw belh3kDaqkEIqAk7vMSWm+nTz1OPncFQ6CcwwgsO/5L5VyU1lBuk7J7qkjUHEcxNril5 Cmnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=W2vN7Sl0nXj0yjJCXQhtiDO3o7WDO8ZyDLVhMTeuOOc=; b=nDa0EiPL8hVxXSC30B6VUs/awVjEghFHKC82SjLiytO3LUxd3j9lXkOLw8pl1InGW/ mEFhWiRYYM2evPsADeTmcrIye8j0aVpdylWCp7zNAaHrYMWbdYRatiDlblokJqLjFpig 0XuMb9TLY5X9EfMCxbLpoUaBHOpVQAYxZrarnLOY3cG6+H+RiqkXh/Z7HQxikpQlyOI+ 07K/r20hSkMC/76PVPIV4qFDTmFGvoZnIsnu9XDn5z8cyozLC3jHyPHoa0YZxqlUpcK4 qDsySTZvlcLcfXqMzQZJiPGqJ3vdrwO5h6TICR+G8LFYUvVyQvxLUWyUnYdGg3yFrzGt jCUw== X-Gm-Message-State: AOAM53245Xwl3WYLF2rb2IPB6IkMeLdeNUyMEa0eiL9pnfVfEfUQwShB Ow9biydlahnmsSZNXiUPaYk0/PZOzn4gSHEuu36VIucLHRTTRA== X-Google-Smtp-Source: ABdhPJzXu0jr+EqmbBLJKBy4GE8cK9ssGj/TjnMCCeARncK2GVoCYxRPt6tgZM9kW2rnOtthZt49cWeemtWc/9trgGI= X-Received: by 2002:a2e:88c9:: with SMTP id a9mr10871456ljk.29.1612185403433; Mon, 01 Feb 2021 05:16:43 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 1 Feb 2021 14:16:26 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="00000000000048a71f05ba462aa7" Subject: Re: [PHP-DEV] Re: [RFC] Enumerations, Round 2 From: nikita.ppv@gmail.com (Nikita Popov) --00000000000048a71f05ba462aa7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 29, 2021 at 6:18 PM Larry Garfield wrote: > 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. > > And we're back again. The RFC has been updated with a steady stream of > smaller improvements based on feedback and testing, and is now in its Fin= al > Form(tm) (we think). The only major change worth noting is that we renam= ed > things. :-) > > An enum with no scalar backing is now called a Pure Enum, made up of Pure > Cases. One that does have backing values is called a Backed Enum, made u= p > of Backed Cases. That change is mainly to allow for future expansion to > non-scalar backing static values, should the use case arise. Reflection > was also reworked a bit to make it more logical. > > https://wiki.php.net/rfc/enumerations > > At this point, Ilija and I consider the RFC done and ready for a vote. > Baring any major issues being brought up, we plan to start the vote in th= e > first half of next week, probably Tuesday-ish. If you have any other bug > reports or tweaks, please speak now or forever hold your patches. > > --Larry Garfield > Two notes: > =E2=80=9Cenum=E2=80=9D becomes a language keyword, with the usual potenti= al for naming conflicts with existing global constants. ... and class names, which is probably more relevant here. It's worth noting that this RFC renders many existing enum libraries unusable, such as myclabs/php-enum, which defines an "abstract class Enum". > Both Pure Enums and Backed Enums implement an internal interface named IterableEnum I really don't like this interface name. We have an "iterable" type in PHP, and having an IterableEnum that is not ... iterable would be somewhat confusing. IIRC you previously called this UnitEnum, which is also not great in that "unitary enum" is not particularly well-established terminology, but I think it's still better than IterableEnum. Regards, Nikita --00000000000048a71f05ba462aa7--