Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37319 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46419 invoked from network); 30 Apr 2008 01:01:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2008 01:01:18 -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 72.14.220.155 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: 72.14.220.155 fg-out-1718.google.com Received: from [72.14.220.155] ([72.14.220.155:35751] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/62-28930-CD4C7184 for ; Tue, 29 Apr 2008 21:01:17 -0400 Received: by fg-out-1718.google.com with SMTP id l27so72829fgb.23 for ; Tue, 29 Apr 2008 18:01:13 -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=IrVel+z08VLcFfI5AjpD8L807qpcsj0StEFgcVKrUx4=; b=n3t/l2TR8OQRF013Vi0ErNJxOOZ4l6yogotps1NLrSuwvdc+FlmVlnVxzkY3Q+/ILmjNSZhUta8gHlp2gOBNAEo3Ejo4HtFudkwnmsLbcvcFloSjkdBi9mnfIx8pEyK16Sk7pymGsXrgyT51zrI4AYZmoIGt8ngNOAx6RkkOxLk= 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=FV6ztdP2KaJ8b6brP/1brZY1V/+qc33qhx5IQaGlmf1YCC+M4JxFJ0EhMUadJGJOOdYm67uNv7jakKAap2r2YEoOAxx4hlxgW6D6+FhmRwWvIK1kSfl6TQzO7zMDQBqOP2UyCHVMEit4wq065Fx95F4IHpj2wtMp2jhVlLGXIuQ= Received: by 10.86.66.11 with SMTP id o11mr641008fga.74.1209517273217; Tue, 29 Apr 2008 18:01:13 -0700 (PDT) Received: by 10.86.59.15 with HTTP; Tue, 29 Apr 2008 18:01:13 -0700 (PDT) Message-ID: <7dd2dc0b0804291801m627a7c31h8dd796d7fa1d1257@mail.gmail.com> Date: Tue, 29 Apr 2008 19:01:13 -0600 To: RQuadling@googlemail.com Cc: "Robert Cummings" , "John Carter -X (johncart - PolicyApp Ltd at Cisco)" , internals@lists.php.net In-Reply-To: <10845a340804291714g7eb10362m17af4abecbadf0e4@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15797_2803022.1209517273187" References: <48169695.9040803@omegavortex.net> <339714303.20080429114607@marcus-boerger.de> <27A086AB-E111-49C1-ABBD-28FB6E1677BD@procata.com> <48175A65.4070301@zend.com> <1209512914.7057.296.camel@blobule> <10845a340804291714g7eb10362m17af4abecbadf0e4@mail.gmail.com> Subject: Re: [PHP-DEV] Class Properties in Interfaces? From: quickshiftin@gmail.com ("Nathan Nobbe") ------=_Part_15797_2803022.1209517273187 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tue, Apr 29, 2008 at 6:14 PM, Richard Quadling wrote: > 2008/4/30 Robert Cummings : > > > > On Tue, 2008-04-29 at 20:04 +0200, John Carter -X (johncart - PolicyApp > > > > Ltd at Cisco) wrote: > > > I think there's been two responses to this query: > > > > > > 1. We can't have properties in interfaces because interfaces don't > have > > > properties. I would say this is tautological and doesn't add anything. > > > > > > 2. Why would you need to? Getters and setters work. > > > > > > So I suppose to answer my question for myself, there's no real > technical > > > reason for not having properties in interfaces, but getters and > setters > > > work just fine and no-one (including me) really misses them. > > > > I have to agree. Enforcing existence of a property is just as much part > > of an interface as enforcing the existence of a method. Why go down the > > clutzy getter and setter method route when properties were meant to be > > accessed. Why should code be made slower? Methods are at least an order > > of magnitude slower than direct property access. > > > > Cheers, > > Rob. > > -- > > http://www.interjinn.com > > Application and Templating Framework for PHP > > There are some advantages. > > 1 - Read only / write only properties can be created more obviously, > rather than having the logic spread thoughout the __magic_functions. > 2 - Automatic document tools get a real benefit from having a defined > mechanism to work from. > not only that, but the only recourse to add logic to access of previously declared public variables without changing the interface is to resort to magic methods. up front, using public member variables may be enticing, there are less instance methods and access is faster, sure. but when, down the road, some logic is required around access, and the only recourse is to employ a magic method, what would be slower then? the magic method doing runtime introspection on the class instance prior to invoking said logic, or having a purpose built method(s) there in the first place? obviously the later; and that is just one more reason why getters and setters, coupled with hidden member variables, make sense, even in php. -nathan ------=_Part_15797_2803022.1209517273187--