Dmitry Stogov wrote:
> How about "import" statements?
> The had effect on current file. How they will behave with your patch?
> The import in one namespace will affect following namespaces... :)

That's correct, import remains a per-file operation, and I pray to god
that no one suggests making it anything else.  This does mean, however,
that if you try to "combine" two files that contain import statements,
it will be necessary to expand the imports.  Fortunately, since
namespaces and imports are absolutely deterministic, this can be done
quite easily.

Note that your concern above is simply a documentation issue, users will
use import correctly if the manual begins with something like:

======
import allows aliasing specific namespaced files and classes within a
file.  For example:

<?php
// externalfile.php defines namespace foo and class bar
require 'externalfile.php';
import foo::bar

$a = new bar;
?>

Note that once a name has been imported to a file, all new classes
within the file cannot conflict.  The following file generates a fatal
error even though gronk::bar is :

<?php
namespace foo {
class bar {}
}
import foo::bar;
namespace gronk {
class bar {}
}
?>

Fatal error: Class name 'bar' coflicts with import name
=====

That will clear up any possible confusion.

> Also this change is inconsistent with renaming "namespace" to "package".

Well it kind of makes namespaces behave more like namespaces, don't you
think?  I already expressed an earlier opinion that namespaces should be
called namespaces, because that is a better name, but that is irrelevant.

This patch has nothing to do with what we call the things, it adds
missing functionality.  You could say that it allows more than one
package per file, but then you end up with namespaces in my opinion, so
there you go.

:)
Greg

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to