Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111907 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 8747 invoked from network); 19 Sep 2020 13:34:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Sep 2020 13:34:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 80D081804B8 for ; Sat, 19 Sep 2020 05:43:36 -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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 ; Sat, 19 Sep 2020 05:43:36 -0700 (PDT) Received: by mail-wr1-f47.google.com with SMTP id j2so8204220wrx.7 for ; Sat, 19 Sep 2020 05:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=Uk2zI0BWyL2+g4Di6oHbiUzuZASA6IZ2KjHWtmOjkds=; b=DqQcC8KxEeNbDdXRYVe7msnourRLU4J19+bG/zSdOnh2UE/aX2pqtx+sVhm/JNiUDS 16Z3hX7HOOqYaD0uTZyu/zY98W2fm2h1ZjerfzolfcVvT/HrflwTK2tY/fh33W+ZPScR SR6BRIHiK74oF5gCQ8TgivbdysqRLwxFKtErEuo9maikrQeV6J5x6qYBCxc7/bULhO0u /ZMi8b5V25wiIE17SsaM8BVZ+XQQwgHA+KsRWgcdu1leDcn3LSbQ76wi5YJGIdSRFKqj bCoZBSMZTTEc9E6hN63VYt24GyRBFqCECVJ7Pam2AQEdscQ85ScLbh9JAWhrP40DzkVs TorA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Uk2zI0BWyL2+g4Di6oHbiUzuZASA6IZ2KjHWtmOjkds=; b=gkIyO0GLIV/W2FSy++z2AO7VRoOxkJQisPcSka+AFae9Xz0iECBzThwI6lbWxR4+ST icwg5gya5Z+lWI1EFrokW16HmLmgp5zFppqSNHn3DqULzRxi9x+DEf1yT8bHL2tUO+8T TPgXQOlFYw+trCJ7W6aWsl9YTQ2Ya/AjGNZM0gUl1k6oQ0IOIGRVi01GUzDgIl+LAnhn 1bDskwXHN7QUFkhZzdaBJ5idvLQmp3Tbpt+fDEPC4V3fsS6ExeZPKQoEBP3fQ/tHdTzZ o5TccyFJ8y3M1qRu21DDMqPE7Na7vrO2xO3ibTvO0fUAtq8TEV/aAaiUAkYJeE2i+GjP M9bA== X-Gm-Message-State: AOAM530uaxsRIeEVYsl/H6h8daP9tVSry93gc/RnFGG78O4VCGvP4eE4 YPpfGWxWHPqFkddKz3DMoIU2Vy36FBI= X-Google-Smtp-Source: ABdhPJwT+prerKuOMD1L8Vh5CDMtDrjY2583s7PYaSyKZVe8GIFDf5agHBfEQW2yekkcMH186b9gGQ== X-Received: by 2002:adf:eb8f:: with SMTP id t15mr19293908wrn.417.1600519410081; Sat, 19 Sep 2020 05:43:30 -0700 (PDT) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id u66sm10545051wme.12.2020.09.19.05.43.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Sep 2020 05:43:29 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <994c6693-a405-ce0f-399c-1518a7eeb321@gmail.com> Date: Sat, 19 Sep 2020 13:43:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] Namespace-private class properties From: rowan.collins@gmail.com (Rowan Tommins) On 17/09/2020 13:28, Olle Härstedt wrote: > We have public, protected and private. Since PHP has no module system, we > have no qualifier to mark a class property as "private for this module". > One solution to this could be to add a new qualifier "internal", to make > properties public within the current namespace. As well as the implementation details of doing this at run-time (which is where PHP does all its access checks right now) the mapping of "namespace" to "module" is not necessarily the most useful one. For instance, if you define an "internal" property in a class called Acme\Frobulator\Handlers\TextFile\Format\CSV, it would be accessible in other classes in namespace Acme\Frobulator\Handlers\TextFile\Format\ and possibly also sub-namespaces like Acme\Frobulator\Handlers\TextFile\Format\Exceptions, but not in other parts of Acme\Frobulator\Handlers\TextFile or Acme\Frobulator as a whole. If Acme\Frobulator was the root of the Composer package, the only way to make something internal to the package as a whole would be to flatten everything into that root namespace, like Acme\Frobulator\Handler_TextFile_Format_CSV That leads me to think that if we do want "module"-level features - be it internal classes, internal properties, or module-level declare() settings - we need a way for the user to define that separately from the fully-qualified namespace. Regards, -- Rowan Tommins (né Collins) [IMSoP]