RE: [PHP-DEV] [PATCH] allowing multiple namespaces per file plus namespaces with brackets
| From: | Andi Gutmans | Date: | Tue, 21 Aug 2007 05:07:24 +0000 |
| Subject: | RE: [PHP-DEV] [PATCH] allowing multiple namespaces per file plus namespaces with brackets | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-31761@lists.php.net to get a copy of this message | ||
Greg,
Will review your patch...
Thanks,
Andi
> -----Original Message-----
> From: Gregory Beaver [mailto:greg@chiaraquartet.net]
> Sent: Monday, August 20, 2007 10:03 PM
> To: Rasmus Lerdorf
> Cc: internals Mailing List
> Subject: Re: [PHP-DEV] [PATCH] allowing multiple namespaces per file
> plus namespaces with brackets
>
> 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
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php