Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120920 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 25514 invoked from network); 19 Aug 2023 09:22:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Aug 2023 09:22:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 84B5E1804B3 for ; Sat, 19 Aug 2023 02:22:07 -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, T_SCC_BODY_TEXT_LINE 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-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 19 Aug 2023 02:22:04 -0700 (PDT) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-52580a24128so2076184a12.2 for ; Sat, 19 Aug 2023 02:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692436922; x=1693041722; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=7tGEqIsqT5lK4RAC4xjNnqoVxbop5LvIQjIucnHIr8s=; b=r0z8h9lq3T97IjNVgj8SPU0QQV37E+BSZUdQ1i6mmCLVk5I85Q1/XE5F3AE03cVHRN mzSPtZb4KuzEqfExbE58J/PZr2rQ9Ym0fXIwEHC3ogSVTtvoC0SBsQ/bL8/o68Gesy53 PXdsGhwBgj7V/BnNYtaq0oEUlTryiAA1vPiRtjDF/8XmuTQ3TJBQ7SoBVx9XAN8Fphfz Cck1hs7pXOiTT+XMMOtWLZl4j/RDfhlgMuAhHSqJxV3EEq7VzK3PfQ0WTVmRCKI6CDto UMG767EG3pK9pAx7SzzCMfEBfRvHWf4wM2DfBtMyDDyEE4O0cCYUcp0h1v5xqSmobG8N DZyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692436922; x=1693041722; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7tGEqIsqT5lK4RAC4xjNnqoVxbop5LvIQjIucnHIr8s=; b=h5zi5O5EszzTS9f24BqNi7mvFnq0QXficyDlEKM5xTgSsMi7KEGdqgGTXWSI7G9BrB BkogWeiRmURPooy5+jkpBSPXU0NafgiPtOsjm3SAuwrHtoW+0zQCVzUG2fIFWtoXUxDA BoGTZHz/gbmWN15ec/Y+6AA8JRozKooztDTOE4edX0yGzlm9jvg5+LV4gML4NTle153Q vVApmKlAqkY3i/7MC6EUas0JRo0hccMJ89xYK+NqSk618XemFkUSOjsVM9KVrcf4JCg6 r2yg2QniR/RtBnzX+Zk+KuFkZjhIyau4lBvFhKwgyiUwsSGWh8N/ehxXRNITHLgKIJWg gFiQ== X-Gm-Message-State: AOJu0Ywi96Q0liNmOjPmk+dMkBsYI5b5xqKXHTGXg5Vg/AiIpdHVZHZ2 vY/2PX1paPXqfgIQmySClqO3IL2dRLg= X-Google-Smtp-Source: AGHT+IG33ujKGAv7lvCQ0QXref3fq1W0oVQRDwfn8QcMIL3bu16ScgysMH3mhc96VPXv+pwNe7fQkg== X-Received: by 2002:a17:906:32d3:b0:99b:d0dc:7e68 with SMTP id k19-20020a17090632d300b0099bd0dc7e68mr1058462ejk.72.1692436922354; Sat, 19 Aug 2023 02:22:02 -0700 (PDT) Received: from smtpclient.apple ([178.197.211.67]) by smtp.gmail.com with ESMTPSA id d11-20020a17090694cb00b009934b1eb577sm2379247ejy.77.2023.08.19.02.22.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Aug 2023 02:22:01 -0700 (PDT) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_381A6DCC-69DC-4AA2-B786-8D8F25A35F74" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Date: Sat, 19 Aug 2023 11:21:50 +0200 In-Reply-To: <64E00A5D.5010108@adviesenzo.nl> Cc: internals@lists.php.net To: Juliette Reinders Folmer References: <64E00A5D.5010108@adviesenzo.nl> X-Mailer: Apple Mail (2.3731.600.7) Subject: Re: [PHP-DEV] Access property of object stored in a constant From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_381A6DCC-69DC-4AA2-B786-8D8F25A35F74 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 19 ao=C3=BBt 2023 =C3=A0 02:18, Juliette Reinders Folmer = a =C3=A9crit : >=20 >=20 > I totally understand that people are trying to do this, but this still = very much feels like scope creep. >=20 > IIRC the new in initializers feature was _intended_ only for enums = (which can't take properties). Now suddenly a "constant" would no longer = be constant... In which case, what's the point of declaring it as a = constant ? >=20 > Smile, > Juliette Hi, It might not be the original intended use. But people are entitled to = use features if they find them handy for their purpose. (It was the = reason I end up using PHP rather than Java: because it solved problems = .) At the time I filed https://github.com/php/php-src/issues/10497, I was = merely exploring the potential of the new ability to have an object in a = constant. The potential use I had back in my head was the following. = Currently, I store some settings in global constants. I was = contemplating replacing those by properties of a readonly object stored = in a global constant. (A fatal issue I discovered later in my journey is = that readonly properties can only be initialised by code inside the = class itself.) But in any case, it is good to have regularity in the language. The fact = that an object is stored in a constant is completely orthogonal with the = fact that the object is mutable, and the proposed patch does not add new = capability. (Conversely, the current limitation does not remove any = capability.) =E2=80=94Claude --Apple-Mail=_381A6DCC-69DC-4AA2-B786-8D8F25A35F74--