Re: YANP (Yet Another Namespace Proposal)
| From: | Jessie Hernandez | Date: | Tue, 12 Jul 2005 04:20:16 +0000 |
| Subject: | Re: YANP (Yet Another Namespace Proposal) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-17236@lists.php.net to get a copy of this message | ||
The attached patch includes variable class name support (test file has also
been updated). To clarify for the benefit of others, this means that the
code below will work. Note that imports are still done on "file-level"
scope, even at runtime, so you can only create objects using variable
import class names for the imports that have been declared in that same
file.
<?php
import my_ns:my_class;
$n = 'my_class';
$c = new $n();
?>
--
Jessie
Stanislav Malyshev wrote:
> JH>>is a znode, and what is assigned to the opcode is "opline->op2 =
> JH>>*class_name". This function is changed to check the import hashtable,
> and if JH>>a match is found, then the znode string value is updated to
> contain the full JH>>class name! Here's some pseudocode:
>
> This of course won't work with variable class names.
Attachment: [application/x-php] _class3.php
Attachment: [text/x-diff] ns_0711.patch
Attachment: [application/x-php] _testns.php
Attachment: [application/x-php] _class3.php
Attachment: [text/x-diff] ns_0711.patch
Attachment: [application/x-php] _testns.php