Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60203 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29946 invoked from network); 18 Apr 2012 21:31:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2012 21:31:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:4460] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/C4-03623-DA23F8F4 for ; Wed, 18 Apr 2012 17:31:26 -0400 Received: (qmail 8982 invoked by uid 98); 18 Apr 2012 21:31:11 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 ( Clear:RC:1(127.0.0.1):. Processed in 0.037168 secs); 18 Apr 2012 21:31:11 -0000 Received: from localhost (HELO www.l-i-e.com) (127.0.0.1) by localhost with SMTP; 18 Apr 2012 21:31:10 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Wed, 18 Apr 2012 16:31:11 -0500 Message-ID: <701fba0b5d6f2c07a7eea59d4b5c68ea.squirrel@www.l-i-e.com> In-Reply-To: References: <01ed01cd19aa$58810e80$09832b80$@alliantinternet.com> Date: Wed, 18 Apr 2012 16:31:11 -0500 To: "PHP Internals" User-Agent: SquirrelMail/1.4.21 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] Ability to assign new object to a class property. From: ceo@l-i-e.com ("Richard Lynch") On Sun, April 15, 2012 5:47 pm, Simon Schick wrote: > Just to add a random thought .... > When do you expect this code to be executed? > > class Foo { > static public $foo = new StdClass(); > } I may be too late to this party, but... For what it's worth, if the non-scalar initialization in class definition were to be implemented, I, the naive PHP developer, would expect the implementation to execute the new StdClass() exactly once (either at compile time or on the instantiation of the first instance) and Foo::$foo or whatever it is would be static in the sense that the same instance of a stdClass would be shared by all Foo instances. I'm with Stas on this one though. Yes, it would be nifty syntactic sugar, and I used to yearn for it. But complex initializations in the constructor is something I've grown used to, and now appreciate as a Feature. Trying to find all the little bits and pieces of non-scalar initializations up and down the chain of a complex class hierarchy is already difficult enough. Tossing in a bunch more places it can happen is Not Good (tm). -- brain cancer update: http://richardlynch.blogspot.com/search/label/brain%20tumor Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE