Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112450 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14053 invoked from network); 7 Dec 2020 09:17:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Dec 2020 09:17:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B42C41804DD for ; Mon, 7 Dec 2020 00:46:16 -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_05,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-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (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, 7 Dec 2020 00:46:13 -0800 (PST) Received: by mail-il1-f169.google.com with SMTP id j12so4294893ilk.3 for ; Mon, 07 Dec 2020 00:46:13 -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=CnxS38zngbOzYiyAmabTVErIPTWor2iM/r9DNp5lfzk=; b=QvtrJNu8S43WMAD9ngv2O9CwC3RF9meTgKv7HV+/eTIhP42VX57sbTRIg/SCy3D4bn 5Enky2tkyJgHOZ6pl0Qq+f66chxu4UxktLT4QeEFXWwmD3OWmkKXu8dmgKNUO+c+FWeS jd68HUwoGmW7bxwMGk5ek2qThCJkUMruCaKeZe2wH5vaPWp+/CSjZa2R3W1avm2VTjtS Foa88ZVZjzGGysybSxzdw964yLyWdwG8OmUQ/2Z4vcd5rH9Ot8jNSOqxct50dHK3UwAl HA7+s7K6vy7QeJLCorZxp2o3PSXS1HfxKYOc0EO3f+t8CxMYpbcDUyMHDNnE9MaRrdpF YJpw== 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=CnxS38zngbOzYiyAmabTVErIPTWor2iM/r9DNp5lfzk=; b=Aokxx6JebxlKtIGFIgeELq19A6EWZep9veTSwqrrTNHNAHWocOIjbWf4XaOPx6Vjg3 DVxzimroKeY5hV8qAJGk03FBgMviySGRLnRpt/xpjSozqJHnmqJxtokH2ReNMP/Mvm5+ kK5K5dvdO1QjJO/AUy671eoy1mzKoxWPrbATzsd41BrHJUp7i8ndKuaVaxuLovlKpX8q Naot8OMOA4NvieHPTRhJASjAeZ7+M5OCXmsitHEuBdl9eyjEVJ957+DRuerfwgPPvEvo 9jHPrZqUqMxtJt605Adun8Q5Vp58dFzlkOhzPK7uoE0T2PnE2iVry/wemz50Oboj8Oit +Huw== X-Gm-Message-State: AOAM5309H8x8OEgOjmt7aYe9D4FbBnhmavJTAFJzrLTIzVsDVrX+B/PY 8l1S/vyHCinb8Ms7HkoG62KzGCw/I1oClJtzm/o1FIpfg2TPRg== X-Google-Smtp-Source: ABdhPJziWSiPyHz72MkO/ocJTx2dD/RXbRx0L1j595dEcsIAo9PyQddcYTd+DA5nEzdl4RPsaCuxubcxdQaKJU5JEZ4= X-Received: by 2002:a92:488f:: with SMTP id j15mr19966206ilg.224.1607330772655; Mon, 07 Dec 2020 00:46:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 7 Dec 2020 09:46:01 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000bda20505b5dbdb7c" Subject: Re: [PHP-DEV] [RFC] Enumerations From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --000000000000bda20505b5dbdb7c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Larry, sob., 5 gru 2020 o 00:25 Larry Garfield napisa=C5= =82(a): > Greetings, denizens of Internals! > > Ilija Tovilo and I have been working for the last few months on adding > support for enumerations and algebraic data types to PHP. This is a > not-small task, so we've broken it up into several stages. The first > stage, unit enumerations, are just about ready for public review and > discussion. > > The overarching plan (for context, NOT the thing to comment on right now) > is here: https://wiki.php.net/rfc/adts > > The first step, for unit enumerations, is here: > > https://wiki.php.net/rfc/enumerations > > There's still a few bits we're sorting out and the implementation is > mostly done, but not 100% complete. Still, it's far enough along to star= t > a discussion on and get broader feedback on the outstanding nits. > > I should note that while the design has been collaborative, credit for th= e > implementation goes entirely to Ilija. Blame for any typos in the RFC > itself go entirely to me. > > *dons flame-retardant suit* > Thanks for taking the topic. I love it. Regarding the `::cases()` method on UnitEnum I guess it'd be more natural to cast enum into an array like: (array) Suit; but I realize it'd be harder to implement. The question is if it was even considered? Regarding the `::from()` method responsible for casting was a natural cast operator considered instead? For eg. $suit =3D (Suit) $record['suit']; Instead of: $suit =3D Suit::from($record['suit']); Cheers, Micha=C5=82 Marcin Brzuchalski --000000000000bda20505b5dbdb7c--