Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112419 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 37522 invoked from network); 5 Dec 2020 03:31:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Dec 2020 03:31:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 165291804C9 for ; Fri, 4 Dec 2020 18:59:38 -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 wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (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, 4 Dec 2020 18:59:37 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 898989CD for ; Fri, 4 Dec 2020 21:59:35 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Dec 2020 21:59:35 -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=zi03Ow/jmq200vYnIjNA7XvXhgP0ZYVM6YuN2l4vZ zk=; b=iPHdj14emzv0vxzAey/7tLoi9AUkJ5u34UtZyxfgWwyMTiHGkbrN/6Fq/ PuOnfTkTvWyvKnPUiWHdVLtxBQnukoYYVIAVq5Vrsl4ykTQ5W3hGy0Vl8Tu5tXQK goEX4cIbuVc+VhUmtuc9UgYzogQawszgFS1ZMhAujYtoQ2VelodVVlFnMX84jj/J jqNzyShZ6gS6bYHvsg8jY6mnDPSucmlPCFer3qQJHJjp0LDGjz5TKKRSNd1dhPZ9 UbOPW+C+0EbEL5RpRvsbWvsfMU9JHxV571IB+vV0Ml/Aw4AwHTLxCn3ouv9G2x/W ZHHRD8ZOm+HZr2pStIn/nk9h+MgMA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeiledghedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffkjghfufggtgfgsehtqhertddttdejnecuhfhrohhmpefnrghrrhih ucfirghrfhhivghlugcuuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeejgfelheetieffheevieelieetgefgffdvheelteefveek keetveefffeiheevudenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghl ughtvggthhdrtghomh X-ME-Proxy: Date: Sat, 5 Dec 2020 02:59:34 +0000 (UTC) To: php internals Message-ID: <32277b43-079d-4cd7-a159-8ad555096742@garfieldtech.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: <32277b43-079d-4cd7-a159-8ad555096742@garfieldtech.com> Subject: Re: [PHP-DEV] [RFC] Enumerations From: larry@garfieldtech.com (Larry Garfield) Dec 4, 2020 7:37:51 PM Paul Crovella : > On Fri, Dec 4, 2020 at 3:25 PM Larry Garfield wr= ote: >>=20 >> Greetings, denizens of Internals! >>=20 >> Ilija Tovilo and I have been working for the last few months on adding s= upport for enumerations and algebraic data types to PHP.=C2=A0 This is a no= t-small task, so we've broken it up into several stages.=C2=A0 The first st= age, unit enumerations, are just about ready for public review and discussi= on. >>=20 >> The overarching plan (for context, NOT the thing to comment on right now= ) is here: https://wiki.php.net/rfc/adts >>=20 >> The first step, for unit enumerations, is here: >>=20 >> https://wiki.php.net/rfc/enumerations >>=20 >> There's still a few bits we're sorting out and the implementation is mos= tly done, but not 100% complete.=C2=A0 Still, it's far enough along to star= t a discussion on and get broader feedback on the outstanding nits. >>=20 >> I should note that while the design has been collaborative, credit for t= he implementation goes entirely to Ilija.=C2=A0 Blame for any typos in the = RFC itself go entirely to me. >>=20 >> *dons flame-retardant suit* >>=20 >> --=20 >> Larry Garfield >> larry@garfieldtech.com >=20 > I'd like to see the specific reasons for the restrictions listed in > Comparison to objects[1]. In general if something's value is even > debatable then the default position should be to remain consistent > with the rest of the language. It should take a strong argument to > introduce any artificial limitation and it's useful to have that in > the RFC. >=20 > [1] https://wiki.php.net/rfc/enumerations#comparison_to_objects >=20 The reasoning general comes down to one of 2 things: * they involve state, and enum cases have no state. They may get reintroduc= ed with tagged unions, but for now methods relating to state would just be = confusing. * we couldn't figure out what possible use they'd have (like static methods= on cases, which without data are exactly the same as normal methods.) --Larry Garfield