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: <?php class A { public function __init() { echo __CLASS__; } } class B extends D { public function __init() { echo __CLASS__; } } class C { public function __init() { echo __CLASS__; } } class D { public function __init() { echo __CLASS__; } } class E { public function __init() { echo __CLASS__; } } ?> 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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php