Re: [patch] Late static bindings (LSB)

From: Date: Sun, 23 Sep 2007 05:16:06 +0000
Subject: Re: [patch] Late static bindings (LSB)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-32421@lists.php.net to get a copy of this message
Like that one, ridiculous: static private function getStruct(&$class) { if(!(is_array(Entity::$struct) && array_key_exists($class, Entity::$struct))) { eval("if(!isset(".$class."::\$structure)) self::array2xml('".$class."');"); eval("Entity::\$struct[\$class] = new SimpleXMLElement( ".$class."::\$structure);"); } return Entity::$struct[$class]; } Do you understand what it does? Do you find it readable? Clean? I don't. Yet that's what I have to write in PHP.
What you were trying to do I wonder?
Maybe the problem arises in PHP because, as far as I know, there is no way to define a function as virtual, like in C++, and so you can't choose between static lookup or dynamic lookup.
In C++, as far as I know, there's no such thing as static virtual function. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#32421) next »