Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107966 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68342 invoked from network); 3 Jan 2020 02:36:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2020 02:36:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0EA731804C2 for ; Thu, 2 Jan 2020 16:40:02 -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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 ; Thu, 2 Jan 2020 16:40:01 -0800 (PST) Received: by mail-yb1-f174.google.com with SMTP id k128so7054528ybc.13 for ; Thu, 02 Jan 2020 16:40:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=pnwCL7V45N/99LyIRckz5winEDERjXoJcXeybPiu7h8=; b=Iuzv7aj95yxdCky2TDZkxG8M5307Qd+qxjrBWiNxNZs1IOzdHQUA7LcJcizkyvoOOa AayMpQPxHozKXiHJlM2XN788UBlVMDilX/zCSx+zNq49kp6nxmlEebWPr7BsxhGkGDAb dvYXauseYURyBtBce1WYRAtbm32SsBah0m56QVokZpbOzmhc8PpVI7ygOvCdVeegZHAj gbCIquy1P1oO20nKXWnvti90WXAj1YVGakgqFsZkLhivEkpmTdMiUWR0PGNZmu9Oj7Hz Ir2MKYHnIK24cOLOfpykcXYZlunWm9m9jDOX6UJvmWOTb0R6NyNg6aTXcKWTEriJL7PZ dqaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=pnwCL7V45N/99LyIRckz5winEDERjXoJcXeybPiu7h8=; b=Xs798ItZLdda7YoHjx/5+wus2L5zHVDZ7iv23c6w/XY2M8GOhXXFSzsPZBEN27XRHD hHevc2Vy0mviR2GFa6oa7AiFA/3qXckFHCKG4ydGzgiXkZRt9lK91feTud+dAGyCgEEt WxGHcxQPPmihAWRK+eF6JORyG8ZsLDVdiSPIsVeAky/hFnbu5QLifB9+n4f7ezwlP3XT 38Ftoui2f9iC3C4Hpy5xoDXKz45+to9XjwXVhWAKrRgTg2HQgQ9/ClFjSTazt+GmRrZu /op/kHrd46wtTGYdvelaKHplPJ9glugtueS4PT4gUMlIxXD/IFlzB8p0mvliXt+aPe5f h9/A== X-Gm-Message-State: APjAAAWhPgJR1NVH0uI46EFVpCt7GHjYL7o3rQR/8X8cvfgMFHi2E709 QQFdwa+5x42CxFUziB8QXPWbZg== X-Google-Smtp-Source: APXvYqwkr3+P56XzvaK6gybJgz9oUl4+nMdrKlguD7id4UtzZvxxWVSDz6ZBQ5qyZy1QehfzARK9uA== X-Received: by 2002:a5b:4c1:: with SMTP id u1mr19357216ybp.344.1578011999128; Thu, 02 Jan 2020 16:39:59 -0800 (PST) Received: from ?IPv6:2601:c0:c680:5cc0:d041:f4cb:aa77:d91e? ([2601:c0:c680:5cc0:d041:f4cb:aa77:d91e]) by smtp.gmail.com with ESMTPSA id f22sm23914725ywb.104.2020.01.02.16.39.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jan 2020 16:39:58 -0800 (PST) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_85B61451-6F6E-40ED-8CFF-2AA219C1B0BF" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Date: Thu, 2 Jan 2020 19:39:57 -0500 In-Reply-To: Cc: PHP internals To: tyson andre References: <5e0d723f.1c69fb81.e2ae8.24e2SMTPIN_ADDED_MISSING@mx.google.com> <74F2DBFC-E63C-428C-A37F-2D0CEE15AD0F@newclarity.net> X-Mailer: Apple Mail (2.3445.104.11) Subject: Re: [PHP-DEV] Initializing constants once, with code? From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_85B61451-6F6E-40ED-8CFF-2AA219C1B0BF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jan 2, 2020, at 7:09 PM, tyson andre = wrote: >=20 >> The problem with using constants is that the value is still hardcoded >> and if we later want to change to pulling the data from a config file=20= >> we have to change all the code that uses those constants.=20 >=20 > It's possible to work around this by using a unique constant name > and define('unique_name', $dynamicExpression) > (and const MY_CLASS_CONST =3D \unique_name;) I do appreciate the attempt to come up with something that is a = workaround. That said, I definitely do not want to do is start using "clever" code = in my implementations because =E2=80=94 one day =E2=80=94 someone else = will have to maintain what I write. Really, I was just asking for a discussion of potentially allowing for = one-time initialization via code for constants and via a = straightforward, obvious syntax and standardized syntax. =20 Effectively I am just asking for immutable static values in a class that = can be access vis the :: syntax. -Mike --Apple-Mail=_85B61451-6F6E-40ED-8CFF-2AA219C1B0BF--