Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50702 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77859 invoked from network); 29 Nov 2010 18:14:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Nov 2010 18:14:51 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 76.96.30.40 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 76.96.30.40 qmta04.emeryville.ca.mail.comcast.net Received: from [76.96.30.40] ([76.96.30.40:50577] helo=qmta04.emeryville.ca.mail.comcast.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/90-09015-A9DE3FC4 for ; Mon, 29 Nov 2010 13:14:51 -0500 Received: from omta09.emeryville.ca.mail.comcast.net ([76.96.30.20]) by qmta04.emeryville.ca.mail.comcast.net with comcast id d5hc1f0020S2fkCA46Eo68; Mon, 29 Nov 2010 18:14:48 +0000 Received: from earth.ufp ([98.220.236.211]) by omta09.emeryville.ca.mail.comcast.net with comcast id d6En1f0014aLjBW8V6En0W; Mon, 29 Nov 2010 18:14:47 +0000 Received: from localhost (localhost [127.0.0.1]) by earth.ufp (Postfix) with ESMTP id AF824D7A51 for ; Mon, 29 Nov 2010 12:14:46 -0600 (CST) Received: from earth.ufp ([127.0.0.1]) by localhost (earth.ufp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3lI0ECQVsKb6 for ; Mon, 29 Nov 2010 12:14:46 -0600 (CST) Received: from garfield.ad.palantir.net (unknown [209.41.114.202]) by earth.ufp (Postfix) with ESMTPSA id 77BADD79DA for ; Mon, 29 Nov 2010 12:14:46 -0600 (CST) Message-ID: <4CF3ED92.3010401@garfieldtech.com> Date: Mon, 29 Nov 2010 12:14:42 -0600 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: internals@lists.php.net References: <003601cb8fd0$f6494e80$e2dbeb80$@com> <4CF3B855.5010406@sugarcrm.com> <003401cb8fee$1be39840$53aac8c0$@com> In-Reply-To: <003401cb8fee$1be39840$53aac8c0$@com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: C-sharp style property get/set syntax for PHP From: larry@garfieldtech.com ("larry@garfieldtech.com") On 11/29/10 11:51 AM, Jonathan Bond-Caron wrote: > Right, it looks the same but the subtle difference is 'property Hours' > wouldn't be registered as a class. It's just container code for get(), set() > methods that would get 'compiled' into opcodes in the class TimePeriod (the > property exists vs. searching for it in runtime). So you can think of it as > a special 'trait' that only applies to properties. > > The idea behind this syntax is you can move the 'property' definition out of > the class so that you can test and re-use it somewhere else (like traits). > > That might not be problem if you can define properties in traits (needs to > be explained in the RFC): I think I'd prefer to use Traits for externally-defined properties rather than defining a new top-level construct. It's fewer moving parts and we don't need to figure out how autoloading would be affected. (Autoload would work the same way it does now for traits... whatever that is.) That would then imply we do need to be able to declare the existence of a property and whether it has get, set, or both independently of the definition, just like methods, so that we can have a proper interface/trait split for properties just as for methods. --Larry Garfield