Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117420 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 28192 invoked from network); 24 Mar 2022 17:24:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Mar 2022 17:24:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8A91A1804B3 for ; Thu, 24 Mar 2022 11:51:02 -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.7 required=5.0 tests=BAYES_05, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_SOFTFAIL, 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-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (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 11:51:01 -0700 (PDT) Received: by mail-ot1-f50.google.com with SMTP id e25-20020a0568301e5900b005b236d5d74fso3959160otj.0 for ; Thu, 24 Mar 2022 11:51:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cohEeT6CpOZkulHQgzcwf6goHyNxo1zmLiBWHX7hIYw=; b=xplSEEQmX6Mr/Zgy5A/SCwH30bXbZimLIztI6OszhCt7HwW0xp/Dde2nqZaGxCo60g ZC0J9KLo84Nmfi4tr9o4C4fvX7hJGhLbDl9daYVDoTFhSuuaKaaYloMpPX5Zh448o6Ds LgMtWdYLqM0nGkUnouqGpS4chTJJPK4bbEfuSyDr5Pl26uDMgbE4laHJOQVZEEA5Y/Fa XrCZ6FfNChhX090Ll/roEVLkJ3pSFtusUz0Kd1KgE21mQ7ta52TS4pzmjqYR3leAjWiE y936q+xEozGCtHI6RUmeaVPCFiJdmomCZjd05O4uQ526LZfrwWvvGZya0fL/G2zIfdk1 82Kw== X-Gm-Message-State: AOAM531qDKQfFtMTVbiPJbkvtJEl+XwsljQENWTLP6Fv3HcbBLBk2wtP piKS7OXTc6HCzODGvuSDGzDueTdDBu76YZ5+9kvEpw== X-Google-Smtp-Source: ABdhPJyPFxZDDvlB6VasOvfdSl4zxlzPavTknVxQCYDW0RxjWZnsBO6bzWg3gPYJB6BaYt//aOryfOfl5U104mGybRA= X-Received: by 2002:a9d:2c42:0:b0:5cd:9e86:44c2 with SMTP id f60-20020a9d2c42000000b005cd9e8644c2mr2859451otb.250.1648147861243; Thu, 24 Mar 2022 11:51:01 -0700 (PDT) MIME-Version: 1.0 References: <76c399cb-fb29-4583-a212-8eb69740c96b@www.fastmail.com> <95fb2485-fa60-a107-5fd2-acdcef09bca3@processus.org> <2abc84a5-0ca2-9431-0585-d3d6ee3df456@processus.org> In-Reply-To: <2abc84a5-0ca2-9431-0585-d3d6ee3df456@processus.org> Date: Thu, 24 Mar 2022 13:50:50 -0500 Message-ID: To: Pierre Cc: Mark Niebergall , Larry Garfield , php internals Content-Type: multipart/alternative; boundary="000000000000ceb80705dafb530b" Subject: Re: [PHP-DEV] Typed constants revisited From: pollita@php.net (Sara Golemon) --000000000000ceb80705dafb530b Content-Type: text/plain; charset="UTF-8" On Thu, Mar 24, 2022 at 10:20 AM Pierre wrote: > > That was exactly my point: the type could simply implicitely be the one > of the original value. > > That works when the initial value is a literal, but what about when it's another cost? class Foo { const BAR = Baz::BAR; const BLING = MY_QUX; } What type are Foo::BAR and Foo::BLING? Suddenly these constants have dependent type and resolving it becomes less trivial. Also, what happens when this code is originally written when MY_QUX is a string, but then gets redefined (because it lives in another library we don't control). Allowing the author to put an explicit type removes all that uncertainty. -Sara --000000000000ceb80705dafb530b--