Re: Please let's not bitch about lazy users not learning C to implement THEIR missing feature. (Was Re: [PHP-DEV] 5.4 again)
| From: | Stas Malyshev | Date: | Tue, 10 May 2011 01:23:08 +0000 |
| Subject: | Re: Please let's not bitch about lazy users not learning C to implement THEIR missing feature. (Was Re: [PHP-DEV] 5.4 again) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52192@lists.php.net to get a copy of this message | ||
Hi!
Objects are only instantiated when requested (getAnnotations() or getAnnotation())So how this happens - does the class store the text of the annotation? Or expressions in the call are evaluated and stored, but the object is not instantiated? What if I call getAnnotation() repeatedly - are they re-instantiated or stored somewhere, and if so - where?
By scalar value you mean constant value? Are constants allowed?2. What is permissible in the arguments of annotation - e.g. can I put any expression there?You are allowed to use any scalar value + array + any object that implements ReflectionAnnotation interface.
So when exactly Bar is instantiated - when getAnnotations() is called?3. What<Foo(<Bar>)> actually means and how it is supposed to be parsed?It would instantiate a class Bar and would pass it as an instance of Foo that is also being created when doing getAnnotations() or getAnnotation('Foo')
This then should be added to the proposal. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 2276. Do we need any special support for bytecode caches?Yes. Every structure which can be annotated now will have a new member in their C structure which is annotations, this structure is populated at compile time and store all the metadata information. So if you have an opcode cache the compilation will not occur, so the annotations will be NULL. That's why the opcode cache will have to store the annotations, so that it can be retrieved every time.