Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31067 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13122 invoked by uid 1010); 18 Jul 2007 20:41:45 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13106 invoked from network); 18 Jul 2007 20:41:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2007 20:41:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=pollita@php.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pollita@php.net; sender-id=pass; domainkeys=good Received-SPF: pass (pb1.pair.com: domain php.net designates 140.211.166.39 as permitted sender) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pollita@php.net X-Host-Fingerprint: 140.211.166.39 osu1.php.net Linux 2.4/2.6 Received: from [140.211.166.39] ([140.211.166.39:60674] helo=osu1.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DC/21-05349-80B7E964 for ; Wed, 18 Jul 2007 16:41:45 -0400 DomainKey-Signature: q=dns; a=rsa-sha1; c=nofws; s=mx; d=php.net; h=From:Subject:To:Date; b=yMs0vBthiIWzGzaiJDQfQt1zV+YWgvtXo49Av8oDm5X2g51xbMGn7iiPB9rpaLTJ 2z0SXVkyUNJEhQV/obsGPeNOfkeE3wUsXXdyvojMCQDWb4oBDyM+Z1uGAXjBkaFa Authentication-Results: osu1.php.net smtp.mail=pollita@php.net; spf=neutral; sender-id=neutral Authentication-Results: osu1.php.net header.from=pollita@php.net; sender-id=neutral Authentication-Results: osu1.php.net smtp.user=pollita; auth=pass (LOGIN) Received-SPF: neutral (osu1.php.net: 207.126.230.225 is neither permitted nor denied by domain of php.net) Received: from [207.126.230.225] ([207.126.230.225:57343] helo=[10.72.106.237]) by osu1.php.net (envelope-from ) (ecelerity 2.2.0.9 r(17728)) with ESMTPSA (cipher=none) id FE/10-10128-60D7E964 for ; Wed, 18 Jul 2007 13:50:15 -0700 Message-ID: <469E7AFC.4060607@php.net> Date: Wed, 18 Jul 2007 13:41:32 -0700 User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: Arnold Daniels CC: internals@lists.php.net References: <469E765C.2080101@adaniels.nl> In-Reply-To: <469E765C.2080101@adaniels.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: private_write/protected_write properties From: pollita@php.net (Sara Golemon) > I'll probably be lynched for bringing up this subject again, since it > caused a long discussion a year ago. Anyway I look in the archives and > there was never a real conclusion made, so I'm bringing it up again. > This time for a feature I personally would like to see in PHP 6. > > Very often I want to be able to be get a property publicly, while only > being able to set it within the class. You can solve this by using a > getPropery() method or by using __get($property), but this feels more > like a workaround. I think the private/public state of properties is > becoming more important now that using public frameworks is becoming > main stream. Therefor I believe this would be a good addition. > Unfortunately, there are a few caveats to this when used with objects, resources, and arrays. The simplest way to explain would be to show some sample code: class foo { public $bar = 'baz'; } class myclass { protected_write $f; private_write $fp; function __construct() { $this->f = new foo; $this->fp = fopen('somefile.txt', 'r'); } } $m = new myclass; $F = $myclass->f; $F->bar = 'blong'; $FP = $myclass->fp; fclose($FP); The explanation of arrays is a bit more involved, but it's got some gotchas too...