Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92141 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41640 invoked from network); 7 Apr 2016 18:32:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Apr 2016 18:32:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.179 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.213.179 mail-ig0-f179.google.com Received: from [209.85.213.179] ([209.85.213.179:33217] helo=mail-ig0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/D2-48788-5D7A6075 for ; Thu, 07 Apr 2016 14:32:55 -0400 Received: by mail-ig0-f179.google.com with SMTP id kb1so19908209igb.0 for ; Thu, 07 Apr 2016 11:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/OZrBnpJ1Q4zwr8hQw2/S6z587Is9xvNYO/VQ+uYkGk=; b=QRAPIiQPP1W8kWHchwYIqagJXqYVFwbAPkm//IRz9qNnuQ2NqkkX+QeggVFl5TSRT+ pEWgnD2cvzbmOudsyVFv5Pzy30yBnqWjr7uyvxHNf08Bvpx2CV3Xx2yYQLXW4NNT/f5s eQMYFvIZh7ZCDnxaXq+J4B7ADSQpWt9ooGJ7xPp0crqA5Xhw2kcS2tMNb16yvjQUg9TT hNmFnHpbhaA/ux3zNgfTBovtm02sdjHW4wmJfmREJUcvbhKllKdj0eH2Q5XGJ85P9v95 JA+Zy3tMJLMKhyuTWrLE4+eT0WiAclAU0aN7/oCsftlqXL90NporrNJQIxUg4W0MnRjm T/0g== 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:from:date :message-id:subject:to:cc; bh=/OZrBnpJ1Q4zwr8hQw2/S6z587Is9xvNYO/VQ+uYkGk=; b=TUV6WHyTjSGwaSZUP+tUfNNJ+ffEnvwU90T4FJTQVGTa2TV2Q0WUnBBZwbbG3Jtybe dpawZuOZ+Lvc0ZoA3OBga9qmFek2yKBH/TyYMqliZqLAWI7k2qkoBRRjZxpF0D1x1lea 3iPmH5w4IHO3NQsfGkA+48x3xPcgVbB+B8VTxZOLR+wrmDrVU87lH+lO63ktJ3O9NOAU bUnbc+Lv7PGQN/eJOrzM85sy5THQmH4c+/1hJFGYilTh2Sbe5OLPEhbIIxfsC2eVcMyK CfY+aseOSS93PL8jgZi0fwitLpyUoKp/e0l52qmDfFG/NnyEhgPMglUoR1OFRsZsz3zv v4nw== X-Gm-Message-State: AD7BkJKjHIScdhV7d8200pM1GTFAzhI0QvXwyzYMQ1Ety7Rxz2NthGgx4PJl7xMOkhwPuqgtSwTrJoZIJ1S1Bg== X-Received: by 10.50.150.74 with SMTP id ug10mr30050317igb.79.1460053970053; Thu, 07 Apr 2016 11:32:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.165.37 with HTTP; Thu, 7 Apr 2016 11:32:30 -0700 (PDT) In-Reply-To: <5706A182.6080401@gmail.com> References: <56ED495C.80809@fleshgrinder.com> <57069A72.7030100@fleshgrinder.com> <5706A182.6080401@gmail.com> Date: Thu, 7 Apr 2016 14:32:30 -0400 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11335e143cf066052fe94ef3 Subject: Re: [PHP-DEV] Access and Visibility Modifiers From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") --001a11335e143cf066052fe94ef3 Content-Type: text/plain; charset=UTF-8 Hi, I was working on a private-class support for PHP an year ago, until I hit a problem I couldn't fix myself. Now I have some more expertise of what I could do to resolve it, but I still didn't start on rebase/update of patch yet. However, I'd like to describe my line of thinking here, so people can debate about it even without me working on an updated patch yet. It's a preliminary work that needs to happen before people spend time on a patch, that will later be transformed into an RFC. The situation that brought me to work on this is, as a library developer, people reuse internal classes that are not meant to be reused outside of library's code. Changes to its API can potentially break consumers of the library, making upgrades hard to happen. To mitigate this problem, I thought about working on two patches to the language that could help library/application developers, self-containing code that is not meant to be reused. They're detailed as follow: 1- Private-class visibility: Only classes in the same namespace (siblings) or child ones could instantiate the class. Cloning would still be possible outside of namespace's scope, the same to access public members. This is what is currently 90% done in: https://github.com/php/php-src/pull/947 It requires changes to Zend Engine to include a start namespace and an end namespace opcodes, allowing to locate in which scope you are. There are failing tests that are not passing because of this right now. 2- Protected-class visibility: It would work the same way as private-class visibility, but with the difference that other classes in the same namespace/child namespaces could access protected members of the specified protected class. Of course both of them would require to go through RFC writing, idea validation, voting and performance assessment process, but it's already a start. Regards, On Thu, Apr 7, 2016 at 2:05 PM, Rowan Collins wrote: > Fleshgrinder wrote on 07/04/2016 18:35: > >> I would like to change above definition for properties since the*var* >> deprecation was voted negative: >> >> # Properties >> private := limited to the current class >> protected := limited to the current and child classes >> var := limited to the current assembly >> public := global >> > > I'm not convinced of the value of reusing the keyword in this way. To me, > there is nothing in the term "var" that means "slightly less than public", > and if we want to have package/assembly/whatever visibility, we should > reserve a new keyword for that use. > > Meanwhile, it might be worth checking the list archives for previous > discussions of package visibility; I know it has come up a couple of times > recently, in various forms, so it would be good not to repeat the same > points again and again. > > Regards, > -- > Rowan Collins > [IMSoP] > -- Guilherme Blanco Lead Architect at E-Block --001a11335e143cf066052fe94ef3--