Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37296 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14284 invoked from network); 29 Apr 2008 15:23:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2008 15:23:04 -0000 Authentication-Results: pb1.pair.com header.from=jeff@procata.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jeff@procata.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain procata.com from 207.58.169.145 cause and error) X-PHP-List-Original-Sender: jeff@procata.com X-Host-Fingerprint: 207.58.169.145 vps.procata.net Linux 2.5 (sometimes 2.4) (4) Received: from [207.58.169.145] ([207.58.169.145:60990] helo=vps.procata.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 83/24-26601-75D37184 for ; Tue, 29 Apr 2008 11:23:03 -0400 Received: from adsl-63-201-158-210.dsl.snfc21.pacbell.net ([63.201.158.210] helo=[192.168.5.38]) by vps.procata.net with esmtp (Exim 4.68) (envelope-from ) id 1JqrfX-0007Ig-PX; Tue, 29 Apr 2008 11:23:00 -0400 Cc: internals@lists.php.net Message-ID: <27A086AB-E111-49C1-ABBD-28FB6E1677BD@procata.com> To: Sebastian Bergmann In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Date: Tue, 29 Apr 2008 08:22:58 -0700 References: <48169695.9040803@omegavortex.net> <339714303.20080429114607@marcus-boerger.de> X-Mailer: Apple Mail (2.919.2) X-ACL-Warn: { X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.procata.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - procata.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] Class Properties in Interfaces? From: jeff@procata.com (Jeff Moore) On Apr 29, 2008, at 3:15 AM, Sebastian Bergmann wrote: > John Carter -X (johncart - PolicyApp Ltd at Cisco) schrieb: >> could you explain why Interfaces can't have properties > > Because interfaces are implemented which makes no sense for > attributes. Sebastian, This is true for the data storage representation of a property. But, when you add the possibility of getters and setters, a property becomes an abstraction. It would make sense that an interface declares abstractly that a property will be available while leaving it up to a class to implement it. Whether the implementation would be through a instance variable or through accessor methods is an implementation detail. This is known as the uniform access principle. http://en.wikipedia.org/wiki/Uniform_access_principle However, right now, we only have the virtual or "missing property" technique of defining accessors with __get and __set, rather than a structural syntax that could be used to verify interface implementations. (The structural way could also offer better reflection, better performance, differing visibility for getters and setters, etc.) Properties in interfaces make no sense now, but if we ever get a structural method of declaring getters and setters, they might make sense. Best Regards, Jeff