Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84604 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64673 invoked from network); 11 Mar 2015 23:57:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2015 23:57:14 -0000 X-Host-Fingerprint: 91.115.245.126 91-115-245-126.adsl.highway.telekom.at Received: from [91.115.245.126] ([91.115.245.126:4725] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 87/00-64353-456D0055 for ; Wed, 11 Mar 2015 18:57:09 -0500 Message-ID: <87.00.64353.456D0055@pb1.pair.com> To: internals@lists.php.net Date: Thu, 12 Mar 2015 00:57:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 References: <6D.2C.32765.10EC0055@pb1.pair.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Posted-By: 91.115.245.126 Subject: Re: [PHP-DEV] static constructor From: mail@deroetzi.de (Johannes Ott) Am 12.03.2015 um 00:30 schrieb Marco Pivetta: > Hey Johannes, > > Why can't this be done at autoloading time? In my opinion this should not be done on autoloading time, but as a own method inside the class for two reasons. 1. Not every class is loaded with autoload-functions, but although directly with include_once or required_once functions 2. The initialization of needed things inside the class should be in the domain of the class itself and not of someone outside. Thats why I proposed to make it a private magic method not a public one. To do by autoload or by calling it inside the included file after class-definition like class B { ... } B::__static(); would require to make it public and means to give the responsibility to do the necessary initialization to someone else. > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > Regards, -- DerOetzi