Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88078 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68430 invoked from network); 7 Sep 2015 07:15:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Sep 2015 07:15:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.160.172 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.160.172 mail-yk0-f172.google.com Received: from [209.85.160.172] ([209.85.160.172:35756] helo=mail-yk0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/F3-40368-A893DE55 for ; Mon, 07 Sep 2015 03:15:22 -0400 Received: by ykek143 with SMTP id k143so73055320yke.2 for ; Mon, 07 Sep 2015 00:15:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=wUie1SlGgmEMYVom3yq+1frz8/ay4CEq2x4tR/HC7VU=; b=g3Kc9M9hXWcuz4eT+UH2gHcDOawOjnIPOjtPzyBNrg2WZllKsE2qeyo5ny9XmFl6k2 NpJFg7MPyCYRbvW8XcRhKcY2QVFntgJwh9B7/swXo6blYqIVx1dNOnT7jSu388pLIpoh D38PyT/1Tx+8BWw/of5R2TD+9Nqc/4jLH393maz9pCmTjX9JUlYBT29XYygp7+IplNh3 1NWwfB5gZBhRXnTHKqDSdswbFVqhz/K6j9kLBVXM/BJ3OmbfX1Kb/qN2IAgTf61lpjJi medjG9vGHGvyih6yqy7b3w/Buokd6hXPjSyKppUSa3HKCVxZcQ7MI0L0qF5k6RaEIvNo VGzg== X-Gm-Message-State: ALoCoQlzeBh1g6XMQmSbOCwzMayMXuDx9QY1uKFCSbTlPbuMNgsriDGFez43JdUMvLBPvYMcOVdX MIME-Version: 1.0 X-Received: by 10.170.55.193 with SMTP id 184mr17584731ykx.99.1441610119757; Mon, 07 Sep 2015 00:15:19 -0700 (PDT) Received: by 10.129.111.197 with HTTP; Mon, 7 Sep 2015 00:15:19 -0700 (PDT) X-Originating-IP: [109.152.54.89] In-Reply-To: <55ED368C.5010209@gmail.com> References: <20150827173432.GA71000@3006.local> <28.A5.59944.15C7CE55@pb1.pair.com> <55ED368C.5010209@gmail.com> Date: Mon, 7 Sep 2015 08:15:19 +0100 Message-ID: To: Stanislav Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary=001a113a6a7617fa9c051f2303be Subject: Re: [PHP-DEV] Re: [RFC] [Concept] Class Constant visibility modifiers in PHP 7.1+ From: pthreads@pthreads.org (Joe Watkins) --001a113a6a7617fa9c051f2303be Content-Type: text/plain; charset=UTF-8 > However, I have hard time seeing how that would apply to constants I don't see what their not changing has to do with their visibility. It's not hard to see a legitimate use case for private constants, a case that springs to mind is where you use a public bitmask for some configuration option but want to keep the shift or mask constants private, because they might change, and you don't want to leak that implementation detail. They are still constant at runtime, but over the course of the life of the codebase they can definitely change, and, they shouldn't be a static member or normal variable. On Mon, Sep 7, 2015 at 8:02 AM, Stanislav Malyshev wrote: > Hi! > > > Funny you should propose this now, I was wanting this feature just the > > other day. This would be a useful addition, and clean up a strange > > inconsistency: why can methods and properties have visibility modifiers, > > but not constants? > > Private and protected methods and properties are private for a reason - > they may be radically changed or gone when the code is changing, and > thus external code should not rely on them, and the way to ensure it is > to deny that code access to them. However, I have hard time seeing how > that would apply to constants - they shouldn't really change, and if > they do, they either shouldn't be constant, or something in your world > changed fundamentally (i.e. scientists discovered that PI actually > equals to 4). I wonder if you find in your code constant that you need > to hide because you foresee it changing - should it really be a constant > at all? > -- > Stas Malyshev > smalyshev@gmail.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a113a6a7617fa9c051f2303be--