Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65115 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98903 invoked from network); 23 Jan 2013 16:25:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jan 2013 16:25:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=jared.williams1@ntlworld.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jared.williams1@ntlworld.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ntlworld.com designates 81.103.221.49 as permitted sender) X-PHP-List-Original-Sender: jared.williams1@ntlworld.com X-Host-Fingerprint: 81.103.221.49 mtaout03-winn.ispmail.ntl.com Solaris 10 (beta) Received: from [81.103.221.49] ([81.103.221.49:57072] helo=mtaout03-winn.ispmail.ntl.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0C/10-30997-01F00015 for ; Wed, 23 Jan 2013 11:25:53 -0500 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20130123162548.GCVY1579.mtaout03-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com>; Wed, 23 Jan 2013 16:25:48 +0000 Received: from p2 ([82.3.17.226]) by aamtaout03-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20130123162548.VYTA4627.aamtaout03-winn.ispmail.ntl.com@p2>; Wed, 23 Jan 2013 16:25:48 +0000 To: "'Pete Boere'" , Date: Wed, 23 Jan 2013 16:28:56 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: Thread-Index: Ac34nFDuqkSehoQzQTWiin/eaz7NnQA6guAg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325 Message-ID: <20130123162548.VYTA4627.aamtaout03-winn.ispmail.ntl.com@p2> X-Cloudmark-Analysis: v=1.1 cv=GaEGOwq9FwezmTggA+b6yC6zDZF2HYaK6RN/tSqdnVA= c=1 sm=0 a=38gTsRmYx9AA:10 a=uObrxnre4hsA:10 a=oHf_AeXmDeQA:10 a=kj9zAlcOel0A:10 a=Hsfd9JpRAAAA:8 a=67BIL_jfAAAA:8 a=oZVmNSIF2vZzZFKzZnMA:9 a=CjuIK1q_8ugA:10 a=VyPlHfQFrpgA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Subject: RE: [PHP-DEV] __init magic method From: jared.williams1@ntlworld.com ("Jared Williams") References: > -----Original Message----- > From: Pete Boere [mailto:pete@the-echoplex.net] > Sent: 22 January 2013 12:30 > To: internals@lists.php.net > Subject: [PHP-DEV] __init magic method > > Has there ever been any discussion on an __init magic method > for bootstraping static properties on class load? > > The usual solution I come up with is manually calling an init > method post class definition, which works, though I'd call it > slighly less than elegant: > > class Foo { > static $bar; > static function init () { > // Create $bar with expressions... > self::$bar = $bar; > } > } > Foo:init(); > > A custom autoloader could of course anticipate this but with > systems like composer that have a shared autoload, it'd be > nicer to use those than rely on a custom loader. > I'd say, that using static at all isn't elegant. There is always a way to avoid it. Jared