Re: [PATCH] Namespace Patch, Alpha 3
| From: | Alex Kiesel | Date: | Mon, 25 Jul 2005 21:48:33 +0000 |
| Subject: | Re: [PATCH] Namespace Patch, Alpha 3 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-17397@lists.php.net to get a copy of this message | ||
Hi Jessie,
first, while your patch applied cleanly (except zend_vm_opcodes.h, which
is generated) the build broke with:
bison -y -p zend -v -d /mnt/home/alex/cvs/php-namespaces/Zend/zend_language_parser.y -o
Zend/zend_language_parser.c
conflicts: 5 shift/reduce
/mnt/home/alex/cvs/php-namespaces/Zend/zend_language_parser.y: expected 4 shift/reduce conflicts
*** Error code 1
I had to increase the expected shift/reduce conflict count to 5 to
continue the build, which then completed successfully.
On Wed, 2005-07-20 at 00:05 -0400, Jessie Hernandez wrote:
> Also, import statements now include the class files, using a new .ini
> variable, "class_path". Files under the directories in the class_path have
> the namespace names as directories and the class names named exactly as the
> file that declares it (like Java), e.g. my_ns:class1 is declared in
> $class_path/my_ns/class1.php.
I don't like this idea; it restricts the developer to this Java-like
class / directory layout. It also restricts him to name his files after
the scheme you defined (which is <classname>.php) - many use other
schemes. Shouldn't PHP let you be free in this kind of decision? I think
yes, especially, as this could also be implemented with the __autoload
function in user-space.
> Again, the only missing feature I know of is "namespace imports". I've been
> thinking about it, and I think the best approach is actually very simple.
Here's another one: the script
<?php
$foo= 'Foo:Bar';
import $foo;
?>
gives me
alex@boost:~/cvs/php-namespaces# sapi/cli/php ~/tests/classes/dynamic_import.php
Parse error: parse error, unexpected T_VARIABLE, expecting T_NAMESPACE_NAME or T_NAMESPACE in
/mnt/home/alex/tests/classes/dynamic_import.php on line 3
(IIRC Stanislav Malyshev already mentioned this in the YANP-thread
already.)
Regards,
-Alex