Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60297 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73218 invoked from network); 24 Apr 2012 22:23:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2012 22:23:52 -0000 Authentication-Results: pb1.pair.com header.from=cpriest@zerocue.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cpriest@zerocue.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zerocue.com designates 74.115.204.80 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 74.115.204.80 migration-relay.domainlocalhost.com Received: from [74.115.204.80] ([74.115.204.80:53256] helo=relay-hub206.domainlocalhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/13-54790-7F7279F4 for ; Tue, 24 Apr 2012 18:23:52 -0400 Received: from MBX202.domain.local ([169.254.19.147]) by HUB206.domain.local ([192.168.69.6]) with mapi id 14.01.0355.002; Tue, 24 Apr 2012 18:23:49 -0400 To: Stas Malyshev , Benjamin Eberlei CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] RFC: Property get/set syntax (added isset/unset and references) Thread-Index: Ac0iFMmMOMpsT+bxSO2aogP0/HTvvQAJndOAAAAVKYAACMhvAAACQBBA Date: Tue, 24 Apr 2012 22:23:48 +0000 Message-ID: <9570D903A3BECE4092E924C2985CE48555BECE83@MBX202.domain.local> References: <9570D903A3BECE4092E924C2985CE48555BEC3C2@MBX202.domain.local> <4F96DE96.7020006@sugarcrm.com> In-Reply-To: <4F96DE96.7020006@sugarcrm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.64.26] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] RFC: Property get/set syntax (added isset/unset and references) From: cpriest@zerocue.com (Clint Priest) Here is a copy of what Dennis had written to me regarding automatic impleme= ntations from C# (the model): > Originally, C# did not support automatically implemented properties.=20 > There are several reasons why they were added. The first reason, is that= while the syntax for properties is the same as the syntax for member varia= bles, there is still some subtle differences in behaviour that cannot be ac= counted for by properties. Here are some examples: > - Variables may be used as input to out/ref arguments. Properties may not= . > - Properties may throw exceptions - variables will never do that. > - Properties may have side effects or take a really long time to execute. > Variables have no side effects and will always be as fast as can be expec= ted for the given type. > - Properties support different accessibility - variables do not > - When using reflection the properties and fields are treated as differen= t MemberTypes so are located differently (GetFields vs GetProperties for example) Some of these above example still apply (reflection, execution time), so th= e automatic implementations may simply be there as a way for authors to ind= icate their intention to make them execute code at a later time. This suggestion below shortens the syntax even further. -----Original Message----- From: Stas Malyshev [mailto:smalyshev@sugarcrm.com]=20 Sent: Tuesday, April 24, 2012 12:11 PM To: Benjamin Eberlei Cc: internals@lists.php.net Subject: Re: [PHP-DEV] RFC: Property get/set syntax (added isset/unset and = references) Hi! > would it be possible to add a second shorthand syntax to the complete=20 > automatic implementation? >=20 > Examples: >=20 > class TimePeriod > { > public $Hours {}; > public property $Hours; > public $Hours {property}; > } How it is different from just public $Hours and why one would need this? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:= http://www.php.net/unsub.php