Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112702 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91202 invoked from network); 1 Jan 2021 18:33:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Jan 2021 18:33:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 348901804A8 for ; Fri, 1 Jan 2021 10:08:49 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 ; Fri, 1 Jan 2021 10:08:47 -0800 (PST) Received: by mail-wr1-f45.google.com with SMTP id m5so22393364wrx.9 for ; Fri, 01 Jan 2021 10:08:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hiWnP5xxVFMNI6LQ3WzHKeNk8utt7EFz0hrV4w0811A=; b=V4KmWSpR4m9B2dj4tmyMs1yIDXuBd3YpYbH8rXcBdJpM3Aw8Jx8ffwK+xHWXaPHctB DkH/LldR65ZKq2eig0jQQG/fcTpZrDiVuQ36TbP/mtBVELHpj8O3zkqvE95mWBBenaR2 /xtUxVwwCBYx8bbq/uwIRi1O0KkK4+dwWvM06b+TV5enmDNZ4jT6u7hGH4tBj76Da3Qv t3L40rF/LTf8NjkzIFZQOsQw/JjKpdlWYiEVhbNoZbj5HwKHrFRd5Kh1bcJUZQyCO9YG aXrMXl4IGstbIcCIPpNk3svYW9vUEE19FrX5NnWxoX8UbsprluR/QiB2dC9Owp1u3Kp/ UMEg== 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=hiWnP5xxVFMNI6LQ3WzHKeNk8utt7EFz0hrV4w0811A=; b=C/PoQzXp+OVxpJqkt1FCfRtMGqxE3JY2HTg0jlD0gpqY+sbsma6qbE5v+fp5pTW0Ui 0Cdo9EiYTwPveO9ef7UR2TGgPTOOxIU/n2Gi694QmGlx5fRSVdftPk/blFSbw+MiXWbO OZxtqtoUKZWETCye7kd4cO/0OBtMBD4cze1GVWOzmzfZNmZTqqDtW/lgQXP+YDrvwp4s ioA9ljQr73Vvimo7+dhJnzzw9kpfOdLN+FSCcbmFkrUVgx5bM4G2A4o4YRbgupnolCFi /7scW8hzENHhwsI4TP5J/8acj8lAlUTy+w/4vT8wlzILlUFPY0eUeW9/Dh7ugZZe0uT3 iQIQ== X-Gm-Message-State: AOAM530xjGjuLux/sSQXs3OBMkBps1oKfQe0UdLe0sBlZf1aF9ZsVxrq cZnpX9xGrGxP1NPOzc7ZaJRl+tMqssVzd1M5C0yaeix7Qvk= X-Google-Smtp-Source: ABdhPJz6xoU/RaimGSA5zXpD48yruv7R7jshvuXc4HtCOFjY6pR77yHg7Xtv2VLDXWpel3d4U7/FDPZKGyB7qqmw5Po= X-Received: by 2002:adf:e406:: with SMTP id g6mr49739589wrm.255.1609524524109; Fri, 01 Jan 2021 10:08:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 1 Jan 2021 19:08:33 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="00000000000084614705b7daa17e" Subject: Re: [PHP-DEV] [RFC] Enumerations, Round 2 From: kontakt@beberlei.de (Benjamin Eberlei) --00000000000084614705b7daa17e Content-Type: text/plain; charset="UTF-8" On Mon, Dec 28, 2020 at 9:22 PM 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. > I think the reflection part is the weakest of this proposal, in my opinion there should not be a ReflectionEnum and ReflectionCase. - ReflectionEnum extends ReflectionClass is problematic - is hasEnum just an alias for hasConstant? - Same for getCases() for getConstants(). - what does getConstant() or ReflectionClassConstant::getValue return for a non scalar enum? the instance? In my opinion you should embrace the "desugarizing" like constructor promotion and just keep everything with the exsiting Reflection structure. > > -- > Larry Garfield > larry@garfieldtech.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --00000000000084614705b7daa17e--