Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37356 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68631 invoked from network); 30 Apr 2008 15:39:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2008 15:39:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=quickshiftin@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=quickshiftin@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.184 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: quickshiftin@gmail.com X-Host-Fingerprint: 209.85.128.184 fk-out-0910.google.com Received: from [209.85.128.184] ([209.85.128.184:7781] helo=fk-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/42-55591-0A298184 for ; Wed, 30 Apr 2008 11:39:16 -0400 Received: by fk-out-0910.google.com with SMTP id z23so337352fkz.7 for ; Wed, 30 Apr 2008 08:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=ubOPevbMKh1M51k7hl0GUeZQGsKMoCi/C1C6XCqCyP8=; b=ljyvTsdiKRhVHSCAG1aCw/WRcxKHUyor2mCQuHVcJ3cRdd2hSrNmSDk8mJEju1Og417pqXcuOnb6hm75zakYWimIERFChP6YQTxvBnZBkMsxEC/zMlcruoMmoFzKLQfoy3bp/NknAV+t0NTIIiQ5vwaypMJpmAmeF10po+si9Sw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=oL4wlOXds4YutUQ2akYCrnmJ9Z3VbSBVySXssVMqjzMvRVdMB4ib59MrttMxqd8QuTnWDTV9QvVcA1z0j9UDcWAnADVova8ie4QEHZDKgcY2zfUHlOSQ0AcwRgK1NsIIt2mj6WYSg272bmyMuNy5PR8RAKF/txqizSXRVSXSC68= Received: by 10.86.31.18 with SMTP id e18mr222607fge.41.1209569944905; Wed, 30 Apr 2008 08:39:04 -0700 (PDT) Received: by 10.86.59.15 with HTTP; Wed, 30 Apr 2008 08:39:04 -0700 (PDT) Message-ID: <7dd2dc0b0804300839t49c5788dsf3e536d4eafb844f@mail.gmail.com> Date: Wed, 30 Apr 2008 09:39:04 -0600 To: "Robert Cummings" Cc: RQuadling@googlemail.com, "John Carter -X (johncart - PolicyApp Ltd at Cisco)" , internals@lists.php.net In-Reply-To: <1209535288.7057.406.camel@blobule> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_18465_33025318.1209569944901" References: <48169695.9040803@omegavortex.net> <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> <1209535288.7057.406.camel@blobule> Subject: Re: [PHP-DEV] Class Properties in Interfaces? From: quickshiftin@gmail.com ("Nathan Nobbe") ------=_Part_18465_33025318.1209569944901 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Apr 30, 2008 at 12:01 AM, Robert Cummings wrote: > > 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: > > > Interface Fibre > { > public $colour; > } > > ?> > > I'm saying that all classes that implement Fibre must have a $colour > property. i didn't say what colour. > > > Class Hair implements Fibre > { > public $colour = null; > } > > $hair = new Hair(); > $hair->colour = 'brown'; > > ?> > > The above is a much less wordy way of doing the following: > > > Interface Fibre > { > public function setColour( $colour ); > > public function getColour(); > } > > Class Hair implements Fibre > { > public $colour = null; > > public function setColour( $colour ) > { > $this->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. so really, all we would get is a group of member variables we know would be there... wow, that seems pretty pointless to me. and in the case of the setter, the client doesnt know about the logic behind the call, so the fact is supplying 3.14 may not result in 3.14 actually getting set. this is why setter methods are import, per my previous statements. i do not consider adding data 'after declaring properties' in interfaces equivalent to supplying an implementation for the method, because php is not strongly typed, therefore no class will ever be able to control what sort of data is set on the properties. that is the entire problem with your proposition. i have to work today, and im sure people are getting sick of my bickering, but truthfully, i would like to know why interfaces were added to php in the first place? where, if any place, did they take inspiration from, java, c++, neither ? i only ask because im dying to know and we're on the topic.. -nathan ------=_Part_18465_33025318.1209569944901--