Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65083 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73491 invoked from network); 22 Jan 2013 13:03:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jan 2013 13:03:03 -0000 Authentication-Results: pb1.pair.com header.from=johannes@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 217.114.211.66 as permitted sender) X-PHP-List-Original-Sender: johannes@php.net X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:45392] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/F6-28294-50E8EF05 for ; Tue, 22 Jan 2013 08:03:02 -0500 Received: from [192.168.2.20] (ppp-93-104-30-133.dynamic.mnet-online.de [93.104.30.133]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 5F23B65086; Tue, 22 Jan 2013 14:02:57 +0100 (CET) To: Pete Boere Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Organization: PHP Development Team Date: Tue, 22 Jan 2013 14:03:47 +0100 Message-ID: <1358859827.1894.3158.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] __init magic method From: johannes@php.net (Johannes =?ISO-8859-1?Q?Schl=FCter?=) Hi, On Tue, 2013-01-22 at 12:29 +0000, Pete Boere wrote: > Has there ever been any discussion on an __init magic method for > bootstraping static properties on class load? Adding an __init method as you wish will just add complexity and gain very little. What complexity am I talking about? Well look at this single file: What should this print? ABCDE? Then the derived class B is initialized before the base class D, which might have strange effects and make debugging hard. So maybe it is ACDEB? This makes the resolution quite complicated. On the other hand: You are showing a goos solution, which is clear and works well. PHP has the global scope, we don't force everything into classes and then create Java-style static{}-madness. johannes