Re: static constructor

From: Date: Wed, 11 Mar 2015 23:57:05 +0000
Subject: Re: static constructor
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-84604@lists.php.net to get a copy of this message
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

« previous php.internals (#84604) next »