Re: [PATCH] allowing multiple namespaces per file plus namespaces with brackets
| From: | Gregory Beaver | Date: | Tue, 21 Aug 2007 05:02:44 +0000 |
| Subject: | Re: [PATCH] allowing multiple namespaces per file plus namespaces with brackets | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-31760@lists.php.net to get a copy of this message | ||
Rasmus Lerdorf wrote:
> Sheez, guys, slow down a tad. Just because he says "no performance
> penalty" in the description, doesn't make it true. Unless I missed
> something in the patch, I don't see how I would resolve the symbols at
> compile-time now which means it has been moved to the executor and in
> doing so it implies a huge performance penalty.
Hi Rasmus,
I'm actually certain that the patch doesn't change any of the symbol
resolution logic or add any need to move things from the compile-time to
the executor. This is because the namespace implementation basically
works more like a #define macro to auto-prepend class names and function
names with namespace names.
Old logic:
request start => CG(namespace) = NULL
T_NAMESPACE ...;
zend_do_namespace() => defines CG(namespace) which is used for creating
class and function entries
php junk
compile end => if (CG(namespace)) destruct CG(namespace), CG(namespace)
= NULL
New logic:
request start => CG(namespace) = NULL
[potential php junk]
T_NAMESPACE ... {
zend_do_namespace() => defines CG(namespace) which is used for creating
class and function entries
php junk
}
zend_do_end_namespace() => destruct CG(namespace), CG(namespace) = NULL
php junk (which can include class/function entries, although that's a
terrible idea)
T_NAMESPACE ... {
zend_do_namespace() => defines CG(namespace) which is used for creating
class and function entries
php junk
}
zend_do_end_namespace() => destruct CG(namespace), CG(namespace) = NULL
compile end => if (CG(namespace)) destruct CG(namespace), CG(namespace)
= NULL
In other words, the only difference is that mid-parse the namespace
#define-like prefix can be modified or removed.
Greg