Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117410 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82232 invoked from network); 24 Mar 2022 05:37:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Mar 2022 05:37:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7FA9F180381 for ; Thu, 24 Mar 2022 00:04:00 -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=-1.6 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS16276 94.23.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from processus.org (ns366368.ip-94-23-14.eu [94.23.14.201]) (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, 24 Mar 2022 00:03:59 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by processus.org (Postfix) with ESMTPA id A89525100319; Thu, 24 Mar 2022 07:03:57 +0000 (UTC) Message-ID: <95fb2485-fa60-a107-5fd2-acdcef09bca3@processus.org> Date: Thu, 24 Mar 2022 08:03:55 +0100 MIME-Version: 1.0 Content-Language: en-US To: Larry Garfield , php internals References: <76c399cb-fb29-4583-a212-8eb69740c96b@www.fastmail.com> In-Reply-To: <76c399cb-fb29-4583-a212-8eb69740c96b@www.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Authentication-Results: processus.org; auth=pass smtp.auth=pierre-php@processus.org smtp.mailfrom=pierre-php@processus.org X-Spamd-Bar: / Subject: Re: [PHP-DEV] Typed constants revisited From: pierre-php@processus.org (Pierre) Le 23/03/2022 à 23:10, Larry Garfield a écrit : > Is there a benefit to it other than "well everything else has types now, so..."? Even if it's esoteric, like in reflection-based meta programming? (I've been dabbling too much in that lately. :-) ) "Everything else does" isn't a compelling argument for me, but there may be others I'm not thinking of. > > --Larry Garfield > Hello, Well I was thinking myself that const being well... constant, and so always defined, type could be determined at compile time without the need to express it in a verbose way. PHP doesn't do any static type inference, but in this case, it could be done almost for free, am I wrong ? If it was determined at compile time, then the type checking on overrides would only be trivial, using the parent occurrence value inferred type. My point is that there's no need to express the type of a value, the value has already has a type. Regards, -- Pierre