News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mike Lively's Blog:
Late static binding....sorta /
September 27, 2007 @ 12:58:00

Mike Lively is happy about one thing - that late static binding (definition) has been committed and will be included with PHP 5.3. Unfortunately, he has a downside too:

The good news is late static binding has been introduced into head and looks like it will be merged into 5.3 before it is released. The horrible news is I really don't think the patch went as far as it needs to.

He talks about the original intention of the functionality (flexible inheritance for static methods/properties/constants) and how it was implemented, but with one small issue - that "static will ALWAYS return the 'resolved' name of the class used to call the current function". He illustrates with a code example showing an extended class returning a static property.

He also mentions two suggestions to help fix this issue:

  • setting the behavior of parent:: such that it forwards the calling class through the next function call.
  • introducing another scope [...] using a new keyword so parent:: could remain the same
1 comment voice your opinion now!
late static binding patch missing functionality parent inheritance late static binding patch missing functionality parent inheritance


blog comments powered by Disqus

Similar Posts

HowTo Forge: How To Harden PHP5 With Suhosin On Fedora 7

Christian Stocker's Blog: Upload Progress Meter for Windows

DevShed: Completing a Query Processor in PHP

Expirmentalworks.net: Inofficial PHP GIT repositories - Importing large trees

Jani Hartikainen's Blog: Understanding Doctrine's NestedSet feature


Community Events











Don't see your event here?
Let us know!


facebook introduction security podcast component opinion example package language overview application hack code composer install hhvm framework symfony2 unittest release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework