Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110756 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59176 invoked from network); 28 Jun 2020 13:45:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jun 2020 13:45:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C68201804B7 for ; Sun, 28 Jun 2020 05:34:13 -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-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 ; Sun, 28 Jun 2020 05:34:13 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id n24so14993591lji.10 for ; Sun, 28 Jun 2020 05:34:13 -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 :cc; bh=i2j1WHdeMW1gA0enk+7PeSf/r5vZml/AO/5hzUG7PhA=; b=I8bbmyi44QPeKddX8hEtGUqdFzJBWzo1h0e/qvSPlUbwhpih4C9qEynX+z/Kl1Zk86 3UnPJOknZS7YowJAoBa0eCn8TTDGqhrgUMskULUAnhhgWizU0K3fJzyqEQ+7HN96UYij jQqJT8uSrUEcbV65p3AiSe9Ha/Lwwc2qebuZ2pdBsFm05FzsR6mmqyMhOEhpnUWgU+Gt A8ZNOc3lHbIV10Y1Yq6xvpfgJ3wN5EdGx5RTxHklN5Z5QbYcePhrayjLpQUJNmdjf1dt tnVIDhVkkey5uN3lpCO9GULrdBNqCnbmGTAA57JHdtbaRg/3bkp63+NeiwECDFyLX7jb 9hTA== 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:cc; bh=i2j1WHdeMW1gA0enk+7PeSf/r5vZml/AO/5hzUG7PhA=; b=VHDSKWO3qcDVjn+laKdnMFHUS0hPwSOvMk7evksPfrVqmZQ/p9wXCYJlQHfWOpvFdL e6geqw5CVSPb/5uG1Zmds4N3bf2UwDkrFLz3f8JwymWSWszj8WS/iiobDrvCtQH0hTaN 1Ido/hTrf21XTuFH23ksGBceYf4DlqGAzLMAE9B/kQDDlmcxAZTQo9khfQGk/Dd/OKh/ +PKk/V5eMuxRQBXpK6POvLVMTtvFXspmnyjhaLdT4yWrn65yCkcNzU4o8NFgvlOHe6BK HFCGxgbkFmt/TN/Aqv5++PnpykFQXrtfccbU3FUrc0R23w61uRagMsKa2jwDmIVPmqS6 KVIg== X-Gm-Message-State: AOAM531SPdb/yj3SgIhY9Lg2JpKfeD5U2NSNEAxjKYm8p9WRM5r/LJh8 rS8ZZYMVxNP1lNA1sFj+4SuaMm+eJcn1XQ1Zja2JQwav X-Google-Smtp-Source: ABdhPJwjGnSnpb95aXCmCaOmQ08XR5coKS4zSs7eYdWzPVXIUuVXW5alZjZdga7BrFBzHnLGn8OvD0lvG/2bHUSoNVw= X-Received: by 2002:a2e:9115:: with SMTP id m21mr5571379ljg.350.1593347651770; Sun, 28 Jun 2020 05:34:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 28 Jun 2020 14:33:55 +0200 Message-ID: To: Stephen Reay Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000c99c7205a92428b6" Subject: Re: [PHP-DEV] Trait constants From: nikita.ppv@gmail.com (Nikita Popov) --000000000000c99c7205a92428b6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Jun 27, 2020 at 3:53 PM Stephen Reay wrote: > Hi, > > It=E2=80=99s always struck me as slightly odd that traits don=E2=80=99t s= upport constants > the way classes and interfaces do. > I tried to find an explanation of the lack of support in the original RFC= , > and came up empty. > > A consequent discussion in R11 has led me here. > Can anyone working on internals explain why traits don=E2=80=99t allow co= nstants > (either technically or philosophically)? > Moreover, what=E2=80=99s the opinion(s) of the list, on adding support fo= r this? > Would an RFC be needed? > Sounds like a reasonable addition. An RFC will be needed to specify the details, which tend to be tricky whenever traits are involved. Some suggestions: * Constants mustn't be accessible directly on the trait, i.e. TraitName::FOOBAR throws. self::FOOBAR within the trait is legal in that "self" is remapped to the using class, as usual. * The same constants important from multiple traits should follow the rules of properties, i.e. require that values match. Conflict resolution for constants should very much *not* be supported. Regards, Nikita --000000000000c99c7205a92428b6--