Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37331 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7764 invoked from network); 30 Apr 2008 06:01:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2008 06:01:32 -0000 Authentication-Results: pb1.pair.com header.from=robert@interjinn.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=robert@interjinn.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain interjinn.com from 66.11.173.122 cause and error) X-PHP-List-Original-Sender: robert@interjinn.com X-Host-Fingerprint: 66.11.173.122 unknown Received: from [66.11.173.122] ([66.11.173.122:56468] helo=interjinn.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/6B-28930-A3B08184 for ; Wed, 30 Apr 2008 02:01:31 -0400 Received: from [192.168.1.3] (blobule.suds [192.168.1.3]) by interjinn.com (Postfix) with ESMTP id 8873C11FB6D; Wed, 30 Apr 2008 02:01:26 -0400 (EDT) To: Nathan Nobbe Cc: RQuadling@googlemail.com, "John Carter -X (johncart - PolicyApp Ltd at Cisco)" , internals@lists.php.net In-Reply-To: <7dd2dc0b0804292222h29c8845k456f6546cbdbece6@mail.gmail.com> References: <48169695.9040803@omegavortex.net> <1209512914.7057.296.camel@blobule> <10845a340804291714g7eb10362m17af4abecbadf0e4@mail.gmail.com> <7dd2dc0b0804291801m627a7c31h8dd796d7fa1d1257@mail.gmail.com> <1209518549.7057.313.camel@blobule> <7dd2dc0b0804292051o4fd5e77eu6f8faecad93c378a@mail.gmail.com> <1209528338.7057.349.camel@blobule> <7dd2dc0b0804292127p484d8c7g9cf852f0a79a8dc6@mail.gmail.com> <1209532046.7057.368.camel@blobule> <7dd2dc0b0804292222h29c8845k456f6546cbdbece6@mail.gmail.com> Content-Type: text/plain Organization: InterJinn Date: Wed, 30 Apr 2008 02:01:28 -0400 Message-ID: <1209535288.7057.406.camel@blobule> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Class Properties in Interfaces? From: robert@interjinn.com (Robert Cummings) On Wed, 2008-04-30 at 01:22 -0400, Nathan Nobbe wrote: > On Wed, Apr 30, 2008 at 1:07 AM, Robert Cummings wrote: > We are not talking about data here. We are talking about > properties. > Data is assigned to a property which is akin to functionality > being > assigned to a method. A property has all the features of the > most simple > getter/setter method combination in one fell statement and > without the > envelope overhead. As such, there is no reason why it could > not be part > of the interface design. > > so a 'property' could be any data type? that sounds contradictory to > the concept of an interface to me. the only special connotation i > have ever encountered for the term 'property' is my *very* brief work > w/ vb.net as a teacher. there is a mechanism whereby getters and > setters can be declared and a member variable can be named.. then > when using instances of the class, client code uses the name of the > 'property' which has the same syntax as accessing a public data > member, however, the client is transparently being driven through the > methods of the 'property'. between SPL ArrayAccess, and magic > methods, php already has multiple ways to realize 'properties'. Seriously, are you having this much difficulty understanding that a property is not itself data until such time as it is given a value? If I say something has colour I haven't said what colour, only that it has colour. Red, blue, green, these are data. "colour" is a property. If I had an interface where I defined the following: I'm saying that all classes that implement Fibre must have a $colour property. i didn't say what colour. colour = 'brown'; ?> The above is a much less wordy way of doing the following: colour = $colour; } public function getColour() { return $this->colour; } } $hair = new Hair(); $hair->setColour( 'brown' ); ?> Now do you see the equivalence? I don't think I can simplify it anymore. Since they are equivalent your argument is void since it hinges on data. To throw your void argument back at you about a "property can be any type" so too can a parameter: $hair->setColour( 3.14 ); This is a feature of a dynamic language, not a flaw in my argument. And to beat the dead horse... a parameter declaration isn't data either. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP