Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113218 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58609 invoked from network); 23 Feb 2021 11:33:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Feb 2021 11:33:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 286161804E4 for ; Tue, 23 Feb 2021 03:21:42 -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.2 required=5.0 tests=BAYES_20,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-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.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 ; Tue, 23 Feb 2021 03:21:41 -0800 (PST) Received: by mail-lj1-f170.google.com with SMTP id e8so23744836ljj.5 for ; Tue, 23 Feb 2021 03:21:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=LUZxK8Nun1rGeWmdl1Dcn1/BvrHUEpzMiP9nUHuhVhY=; b=UXiRNamnT7TjA6XEri8HBM4UndH9vxo8ISmzI7yEqSLMrc/aVVUjB6VdijOkmU493J c89Fmw/wy/S/ycdLNDG0Afd3Uq9KNQo9PooWXFjpxPFzWCbPmfmQ8pyDmTIGgI1fE7yP YIPo+VTTm6+UrKx/QAZijbiyBEpuR4Myu85Lt6QLwXWJXp+5vN2KGW0K/sGeQdP1+uoE tEXnI5ciaM52i7EB0ZvTmzgTSEkYAAbsXfnhLt0GwToVrU2jwtdT2JEdfSEbrBeT3uqk nJ/l3O+m+lr0nTQ7ZgU7RMtRXj5RUBevEWzTk8KhSl8ucqz+hbNTSXWpPI2LaZ80PWiP hYdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=LUZxK8Nun1rGeWmdl1Dcn1/BvrHUEpzMiP9nUHuhVhY=; b=ee3G59lmkI0vmFhwE1ydtaRvGdNS4ZlhXNr8DY0LdNB67vU257n7H4jQ+p3Qnhnibq HlvjRVrzt2llu7889lUV7pCG+/FuIh+NImTJRPQ5KzQoakVSWREYVvhcodtUwIfRhO9h M4pNnUcUIEJ6NEIQcH27JXiWynE6d1tUpYWMYnlCGGWCfFVUjWyhxIMCv44WKVIVryaj hPo4seePFXESmReu0Zheiz7iCEdSVtyEdDUX4XSSUhqTquMSkZNpZCL85n1oKGTcIaK8 ggLaYSBmd7OlYaHHidxJ/pYYLH1N5i0YGbcPKaZHiCwOKIOixKAXq4Rb1VlmF5lL9dW+ XEHw== X-Gm-Message-State: AOAM5329D0090jIXGYsoVxO/W4lo06yS+cYwuGtCBfEBhA1Jv8lrS+Ao 46vwJkbBHhB3jehcZfysm6s014kMsY2JsOU1q5SGHCCb2ksZFw== X-Google-Smtp-Source: ABdhPJwguPZzHccuUFQXTFmdJPECdI7Q4wSRmGZFuROpV307bHz2AXQURRlJtUK95b4tVS1aobx155VH18DxxEVHYxw= X-Received: by 2002:a05:651c:2050:: with SMTP id t16mr17390204ljo.109.1614079299930; Tue, 23 Feb 2021 03:21:39 -0800 (PST) MIME-Version: 1.0 Date: Tue, 23 Feb 2021 12:21:24 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000004fce4605bbff1f08" Subject: Avoiding enum reserved keyword From: nikita.ppv@gmail.com (Nikita Popov) --0000000000004fce4605bbff1f08 Content-Type: text/plain; charset="UTF-8" Hi internals, I'm a bit concerned about the addition of the "enum" reserved keyword as part of https://wiki.php.net/rfc/enumerations. The problem is that there are quite a few existing enum libraries (such as https://github.com/myclabs/php-enum) that define an Enum class. While the implementation of enums in PHP 8 obsoletes these libraries, it still constitutes a migration problem, especially for libraries supporting more than one PHP version. I don't believe that the keyword is strictly necessary: We can recognize enum declarations as T_STRING T_STRING, where the former is checked to be equal to "enum" by the parser. It so happens that this is syntactically unambiguous at this time. We may be forced to introduce the keyword at a later time, if it becomes ambiguous. Another possibility would be to recognize T_ENUM in the lexer, but only if it is followed by whitespace and an identifier. This would possibly be friendlier for tooling using token_get_all(). It would not permit comments in between the tokens though. Thoughts? Regards, Nikita --0000000000004fce4605bbff1f08--