Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125731 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id BD8B71A00BD for ; Wed, 2 Oct 2024 18:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1727893934; bh=5ktBYwxQAotQ4gQ3rUwf62W3D2nUfiJbzuFB64bygss=; h=Date:From:To:In-Reply-To:References:Subject:From; b=YySWwsHNMWeE3LmLbQJRqYAJH+fXa6dV0rHxzdJGOxiC8vWIe/UG9oooML4pzcPSx QnzWDcxJ5u0cai/bwKiVV9MHg+3zUhGdqFcZ2piYLswVBeUBTcTnbPxNOmZ1c8ZubL Z+FEutGnuprHWwwCxEDhZGjhd+EUfMY8vqunceteu4MhwqwZvIUPVdAgrveyNgpi8Z g4YWc+YYmfuVyShj3Mdr3AIYuwcT8L3NJAqyLWp5IdUcFmRraSuhZ4DyQT149muRMV an592MiFWwXnb38ZQb7i92hidxSoLzehg367LlMbBqFXS8ZMp4aN9BaATh+uReXOKv N9k8GgDtwpIhg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3CB29180068 for ; Wed, 2 Oct 2024 18:32:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 2 Oct 2024 18:32:13 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id B19DB1140086 for ; Wed, 2 Oct 2024 14:29:59 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-01.internal (MEProxy); Wed, 02 Oct 2024 14:29:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1727893799; x=1727980199; bh=WLKqif1SKcMnFFxPbfrYv M6tjQq3QTPHv0uJ6kuEKd8=; b=bHawNdPRQOTgSgEnhVk89ef++WKoatvnB9+Lc KJXA88VuOMkvfybvquC0NodsXXO/uxgDbRAZp/vdVbJjXWtixudJYa1gNjWoStNC dxOFKUUjZE8Q7Z3zQ4GLY4oduihtVcvq6n1RBI4pZkaICV3NPgoxgGMGfhHmT9tK QDp58qI4dFCqDFGUntTpF+38XnGgIIwU9p+4AZfFn03pHK9UQBHk3RWaesTysu53 oTOOCEStwsQJ8Vk0DK+h06jo3N+b88hzo+SqHo+eqNZySeB/3GPyDfBVHo5oWNOM 6zbz6uZjPyNjT0FVloXv97d0hNk3tz/BQiRQ6CTiywuG13vOw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727893799; x= 1727980199; bh=WLKqif1SKcMnFFxPbfrYvM6tjQq3QTPHv0uJ6kuEKd8=; b=j o1lWXOcyCM7sgCIunaqYoMXCPX2Y9NVQN1uWBshlOy69Cxh/Tfo0htjzhxnopecl 6Qn+KGJjjmE0t714BhW/3yj5Xoobyo51XfW5DGiAHWWjUvfgOW3mpZVZTEaT5RSP EooVN04cjSUPM7UK7Azp085YRvAJsJyCuCO2KFcdq5PUCvRGdxLNbYc6fSWENzx6 2w6bFU2hjSG79bnZk5MpoM455bD7K+LQ15ZA1cpjxs35bPiCytkNHpjU9i5G29x3 2LoXyV/Mav676v7rJOmjTv1BQZB16or/LhRD0agisPuxj5WXR37SrTQefBqb/hUp +v8FuIdyJJ++3PVKfxlEA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduledguddvvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefoggffhffvkfgjfhfutgfgsehtqhertdertdej necuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfh hivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhepffeiiedvhfdvgedutddt geetieeugeevhfetheeffeefteduiedthedtgeejueeinecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgv tghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtph htthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 3D4F729C006F; Wed, 2 Oct 2024 14:29:59 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 02 Oct 2024 13:29:38 -0500 To: "php internals" Message-ID: In-Reply-To: References: <66FC7B9F.5070906@adviesenzo.nl> Subject: Re: [PHP-DEV] [RFC] [Discussion] Add get_declared_enums() function Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Wed, Oct 2, 2024, at 7:27 AM, Alexandru P=C4=83tr=C4=83nescu wrote: > I think my view comes from when I initially dug (15+ years ago) into=20 > what an enum in Java is, and learned that it is just a syntactic sugar= ,=20 > and a final class would be generated implementing `Comparable` and=20 > extending an abstract class `Enum`. >=20 > And I think in PHP that could be a similar view. And most of the=20 > limitations we have are not impossible to create with a standard class. That is roughly the way enums are implemented in several languages, incl= uding PHP. =20 > I think in time we might get to remove some limitations. > I, personally, don't agree with the `Stringable` related limitation. This has been discussed numerous times already. Please don't bring it up= here, it's not relevant to this thread. > And also with the limitation on no state. In Java this is the simple=20 > way to create a singleton: an enum with one case; and we can't have=20 > this in PHP. That is what we mean by ADTs or Tagged Unions (various names for the sam= e thing), and it's something Ilija and I have on the roadmap. It's been= on the roadmap since the first enum release, but we deliberately punted= it for later to keep the initial RFC manageable. It's also dependent o= n the pattern matching RFC, which hopefully we'll be able to bring up fo= r discussion for 8.5. > If we remove the limitations, should we reclassify at that point enums=20 > as classes? Enums already are classes. I don't know what reclassification you're ta= lking about. The RFC is about adding a "get me a list of only those cla= sses that are enums" function to PHP. Changing how Enums behave or are = implemented is wildly out of scope. --Larry Garfield