Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23567 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30729 invoked by uid 1010); 18 May 2006 15:40:37 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 30714 invoked from network); 18 May 2006 15:40:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 May 2006 15:40:37 -0000 X-PHP-List-Original-Sender: dante@vocalspace.com X-Host-Fingerprint: 69.56.193.72 fox02.stravio.com Linux 2.5 (sometimes 2.4) (4) Received: from ([69.56.193.72:43570] helo=fox02.stravio.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 46/D9-19568-3759C644 for ; Thu, 18 May 2006 11:40:35 -0400 Received: from [127.0.0.1] (unknown [66.243.31.162]) by fox02.stravio.com (Postfix) with ESMTP id C727926C303; Thu, 18 May 2006 10:40:32 -0500 (CDT) Message-ID: <446C956B.6000802@vocalspace.com> Date: Thu, 18 May 2006 10:40:27 -0500 User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: Jeff Moore Cc: Marcus Boerger , Jason Garber , Christian Schneider , internals@lists.php.net References: <785810036.20060511193536@ionzoft.com> <44647B7A.2070301@php.net> <932738738.20060513112734@marcus-boerger.de> <837405862.20060513223403@ionzoft.com> <36828701.20060514110529@marcus-boerger.de> <31269879.20060514221212@marcus-boerger.de> <1327845846.20060514222154@marcus-boerger.de> <1562034641.20060516203354@marcus-boerger.de> <7.0.1.0.2.20060516235201.090f10a8@zend.com> <7.0.1.0.2.20060516142654.02c78380@zend.com> <596643859.20060516233753@marcus-boerger.de> <7.0.1.0.2.20060516144030.039abe98@zend.com> <1531743211.20060516234945@marcus-boerger.de> <1014418169.20060516181322@ionzoft.com> <1677590447.20060517002135@marcus-boerger.de> <446A5B52.9060001@cschneid.com> <27079878.20060516191743@ionzoft.com> <446A601A.8010205@vocalspace.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] private, protected, readonly, public From: dante@vocalspace.com ("D. Dante Lorenso") Jeff Moore wrote: > On May 16, 2006, at 7:28 PM, D. Dante Lorenso wrote: >> I'm not familiar with this OOP concept from any other language. >> Perhaps it exists, but if it doesn't, is there a reason why? > Its hard to find a major OO language that does not have > property/accessor method support. It's not the p, p, p, __get or __set I was unfamiliar with. It's the 'readonly' construct that I had not seen in any other language. > The Pandora's box of complexity was opened when PHP got __get and > __set. readonly or readable is just a bandaid that fixes one use case > of one problem, but does it in a way that doesn't help fix any of the > other problems in the future. There is nothing wrong with simple > properties in PHP just the way they are now. There is also nothing > wrong with __get or __set. They work well when you truly need virtual > properties, such as for an active record or a proxy class. Sounds like you are against adding 'readonly'. > What PHP is missing is a way to associate individual accessor methods > with individual properties ... Isn't that what you do when you define the class without using __get and __set? class A { private $x; public $y; protected $z; function x() { return $this->x; } ... } $A = new A(); To associate an 'accessor method' with a property other than using the $A->x syntax, you just put () at the end of the call as in: $a->x() and now you have a method call. Seems like we don't need anything new in the language for that. I thought this thread was about wanting to create some new hybrid visibility/access level other than p/full, p/full, and p/full. Something along the lines of declaring different levels of access to variables based on visibility such that: * public readable, but also protected readable/writable * protected readable, but also private readable/writable Although that sounds like fun, I'm all about duplicating what other languages have and find useful than inventing new oop concepts for the fun of academic exercise. Dante