Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112628 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52586 invoked from network); 29 Dec 2020 01:06:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Dec 2020 01:06:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EEBA71804A7 for ; Mon, 28 Dec 2020 16:40:36 -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.1 required=5.0 tests=BAYES_00,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-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (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, 28 Dec 2020 16:40:36 -0800 (PST) Received: by mail-oi1-f170.google.com with SMTP id q205so13128630oig.13 for ; Mon, 28 Dec 2020 16:40:36 -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=6aO/V0D1v1g78UHU2/BWkPqfAHMHNcxPt0MjjrBM+vA=; b=FMfKZJfJwAoKGM/9x7VKNinKk7Ls+luCDoQPzxwSLxHXlrFcebd9tSpZDhADHRtcyO yrAQy1WT9yiTFvbeggKfyWGMcqFPNYLh/+HfB+8e4Z557kO/CzhqD3bzjLrY/oDybByY 9LJcCG7X3+HSQj98yI3rTMZ9T5tR9W1Orz2TL6WnFfIFKWEmdMySJP23LkIhC0bwcNmO Kds99Dp26KC+XfFA2p34u/Vh7GFB6LsL93r2fnI68b7884lCvf21L9iLQEi7I9BCi8Tc uC5TfoCTcjaG4Y0L1h1Dg4WbY/Bb3h+w1kDdote+z8UgYVx9PdpJv8b2B7PNge8SFnB3 Ct0A== 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=6aO/V0D1v1g78UHU2/BWkPqfAHMHNcxPt0MjjrBM+vA=; b=qvRIYjHaDrXwnrMyWm1P8byfQimS70h5VnnptAxF7rDdBzhJnAbuLY5BkO76AAoSzR d1kbCQWdPCZXCXBWav5L8xqwpzUetZ+Zki6yphIFQt2Yk9KUXUMYMbxNMmVfOwriBZR+ XukCNw/dnzM4scMXO3eZDBXQsCbEIuAtSAMK6mFSkx5f2pbqens/jhSF4OxwIoMdCRBq SUPT+xj6S/9tJysLIcuuXNAyAdwlZhpanMrRoDNIsO8sGyUorj7qbZDFwMBKMviUigw3 3m/x1bW27znsb6XVsHpMaEAVRrXdEZPes07vdmv+WZKo6TqH/lDId7m/xuqg3+j6Zald g/uw== X-Gm-Message-State: AOAM532df3JEaT1GW+PL8uj0qDYmb7GyZn8mun+ihxnJJ82ZpiA5MuQ3 yzmDvRbrkPeFOoVJIeJtphpGDz/hdBq+z7dRGwA= X-Google-Smtp-Source: ABdhPJx5WWE4GqULG4/20stIX4lHYo1Q8CULeAZdt1CEdB0WFXXoTIx0mxX4uKuA6pemPgdsXiYkELalClA8gOJpw+k= X-Received: by 2002:aca:fcd7:: with SMTP id a206mr925425oii.134.1609202433907; Mon, 28 Dec 2020 16:40:33 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 29 Dec 2020 01:40:23 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="00000000000071e04905b78fa3bf" Subject: Re: [PHP-DEV] [RFC] Enumerations, Round 2 From: benjamin.morel@gmail.com (Benjamin Morel) --00000000000071e04905b78fa3bf Content-Type: text/plain; charset="UTF-8" Hi Larry, thank you for the updated RFC! I love it, and having played with the implementation, I can say I love it so far as well. I have one suggestion regarding reflection: Shouldn't ReflectionCase expose an additional getInstance() method, that would return the case instance, such as Suit::HEARTS? Also, I noticed 2 typos in the code samples: - in "Enumerated Methods", 1st code block: missing "implements Colorful" after "enum Suit" - in "Enumerated Methods", 2nd code block: missing "public function color()" after "private function __construct() {}" Finally, I got a segmentation fault while trying to use what I think is an unsupported syntax (removing the ":string" from a scalar enum), where is the correct place to report this? The GitHub PR? Good luck with the RFC! - Benjamin On Mon, 28 Dec 2020 at 21:22, 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. > > -- > Larry Garfield > larry@garfieldtech.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --00000000000071e04905b78fa3bf--