Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112460 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62405 invoked from network); 7 Dec 2020 16:29:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Dec 2020 16:29:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 087DD180511 for ; Mon, 7 Dec 2020 07:58:23 -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 out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (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 ; Mon, 7 Dec 2020 07:58:22 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E92085C021A for ; Mon, 7 Dec 2020 10:58:21 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute4.internal (MEProxy); Mon, 07 Dec 2020 10:58:21 -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=/5RAi4Omhs8sh+ItFTmmjA43BiOii0ZX0W/sBN0Gx wI=; b=rxnMrUeIwoAgS4UVVIDihU0UBHOQQ6/9veiIBzEy8hrE2emu1ZCX9T+FK nqUy/YrsxNdnOPW7PNlxznZnm4UPzLh0yHwb0R+6fZN36Dr1SGnEFElrudYEJROy FdYy0VoWlWI/QBNkwJrbHpJIbN59v6siOkeN5gjZH1KYhX8IbEKNFsyIbD5zt10U 5JUNNgMqrzLoT8uF5NKVZsM7Jo+PyxWTckyqVIDhmvpwpvhMaXcOXlpVqT+LNvUp nlj4vSzBbXt2+XKu8yNPOqpyjTvbdvunfsCjlsE3PeaaFwS3kR5RtFM1H1ZNR7Te 5Wnl4Q1XG8I6rVXmZ7Roi2hzcS+0A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudejgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepffffffejffdugfegvedviedttedvgfejffefffej leefjeetveehgefhhfdvgfelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 60F0A14200A2; Mon, 7 Dec 2020 10:58:21 -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: <48a411eb-3306-4923-7a9f-39b045240f38@gmail.com> References: <244f66fb-81c3-4cf7-a0b5-0a3233e3b9e1@www.fastmail.com> <48a411eb-3306-4923-7a9f-39b045240f38@gmail.com> Date: Mon, 07 Dec 2020 09:58:00 -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 Mon, Dec 7, 2020, at 9:56 AM, Rowan Tommins wrote: > On 07/12/2020 15:26, Larry Garfield wrote: > > Assuming it's feasible to do, what do people feel about supporting t= hat? IMO, cases(), from(), and values() need to be kept no matter what = as they're more self documenting and can be passed around as callables. = So the question is just whether we should also try to add casting as an= alias to those operations. >=20 >=20 > From my experience answering questions about SimpleXML on Stack=20 > Overflow, I can confirm that people find magic behaviour of (string)=20= > hard to discover and understand, and it's not uncommon to see someone=20= > write $foo->__toString() because they're more familiar with methods. >=20 > That's even more true for other casts, e.g. (int)$foo and (float)$foo,= =20 > which can be supported by built-in classes but not userland ones, so a= re=20 > even less discoverable. >=20 > I can see the appeal of overloading cast syntax, but I would personall= y=20 > be on the "just use explicit methods" side. >=20 > Regards, >=20 > --=20 > Rowan Tommins (n=C3=A9 Collins) > [IMSoP] I spoke with Ilija and it turns out it would be really hard to do anyway= , so casts are out. I rescind my request for feedback on that point. :-= ) --Larry Garfield