On Mon, 13 Sep 2010 21:51:32 +0100, Stas Malyshev <smalys...@sugarcrm.com>
wrote:
If I'm not mistaken, the current implementation instantiates an object
each time getAnnotation() is called, but it was proposed to change this
into a lazy-loading mechanism with the same instance returned every time
for each annotation. In that case, we'd only need to validate that one
time.
(What I describe as "proposed" is actually the implemented behavior)
Object instances can't be bytecode-cached, so when are they
instantiated? Does it mean it's stateful and mutable?
You're confusing multiple calls to the script to multiple calls to
getAnnotation().
You're right in that one cannot keep objects between requests. The
annotation will have to be regenerated, and possibly validated, on each
script call. It's indeed unfortunate, but we could add the possibility of
turning off these verifications in production or add a hook that
extensions could use so they could cache the result of the validation.
It's not a show-stopper.
However, this does not equal instantiations for each call to
getAnnotation(). This only creates one object:
class A extends ReflectionAnnotation {}
[A]
class H { }
$refH = new ReflectionClass("H");
$refH->getAnnotations();
$refH->getAnnotations();
--
Gustavo Lopes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php