Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110495 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41419 invoked from network); 12 Jun 2020 10:08:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Jun 2020 10:08:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5EB451804C3 for ; Fri, 12 Jun 2020 01:52:37 -0700 (PDT) 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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) (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, 12 Jun 2020 01:52:36 -0700 (PDT) Received: by mail-io1-f42.google.com with SMTP id w18so9425850iom.5 for ; Fri, 12 Jun 2020 01:52:36 -0700 (PDT) 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; bh=ROuDLUtYTfPAiczgV/cSEs3ukyaZwS0roQImnbGB1w4=; b=bU0cBWARznmND4yEeMIx9YcJDbJ4Ry5E5wy1idFLKyd3Ejva0NFVTRBDeKCs9usiH8 80lariYpND5seu4HynXTVR3LqrV3bLD9jhKYzW6atIjpC6ov23IjUobiM1Mz9aDUp1lH ypFP8kDWRz73YkJatmGh4kSITP6dRjTB6/mAJck5tCQOxP4TVte7kmJZwp6JDrviYryi rM4A67AvT5b4Sylf0wj11YV41XGmoSlCBij7VlqUKFP+FtKzvN83eNr85A/jxZg2zn0X KuI8eXhbjtks8D2E7XHReqJCnwHKSjbT7DUVIxZZXH9pqqz9qObeap7q8IP2O44zng01 bDnw== 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; bh=ROuDLUtYTfPAiczgV/cSEs3ukyaZwS0roQImnbGB1w4=; b=qO95eEbg6L3gN1SKHUVcq0iU7riEoU9jqVbJC+bhpJvT+DPsIt4nseu5mAyyjjXvZF E7tLqD2waEk4oTjLodLyvOpBD4TWQS3zDEDpJV8+oXNJL51BsEvDgmQWPN7HOWD3XBlN f3T2Z+PYMqD2ta/BdW9/OlC6feUTF+TsnB9vM9g8/DmweWxjsnEmpOk4TyqFpHOdFCO6 kxQwWvzox83TCwMoOVmFVwu/b3qCwaYzD1VFO7mOrvqc1VbY5XoBCLHYQCU/4Vwic5TJ zpop1NZDTlCDGzIycI7JB6OKjhfed67V1LGh7cgvq4/QAFCkYX1dbNz1w3HZPwMVeKQu fNjA== X-Gm-Message-State: AOAM530epJLnGDS0oyCE+wNp643qCbMalVxNNJFqz3T++9cnSgFWWlAR 9jt516LErxwh4eLMcykxs6dJmyq9rYyFkYODXiPCmw== X-Google-Smtp-Source: ABdhPJxbLyzRZCttjxsoHa+euaiwQ94Jhsd+J2MWidzVnYAcWfJWgkIy/9FDFOfbZgs31vGQmDqJ+OYulgYqebVNMMo= X-Received: by 2002:a05:6602:2437:: with SMTP id g23mr12606810iob.5.1591951956030; Fri, 12 Jun 2020 01:52:36 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 12 Jun 2020 09:52:23 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000d6b9d405a7df3247" Subject: Re: [PHP-DEV] Revisiting proposal for addition of `get_class_constants()` From: rowan.collins@gmail.com (Rowan Tommins) --000000000000d6b9d405a7df3247 Content-Type: text/plain; charset="UTF-8" On Fri, 12 Jun 2020 at 05:32, Troy McCabe wrote: > > > You do mention performance as a benefit, but it's not immediately > obvious to me which use-cases are bottlenecked by class constant reflection. > > Enum implementations are the big case for this. > I've also used it in the past for generating exception messages, because the base Exception class requires $code to be int, so given a value of 1011, I wanted to map back to a constant like "MyException::TYPE_FOO". If the concern is that we will end up with too many of these as global functions, might there be value in a "lightweight reflection" API, which gave access to things like this without the full power or performance cost of Reflection? Regards, -- Rowan Tommins [IMSoP] --000000000000d6b9d405a7df3247--