Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify when imported names become available #238

Open
mattacosta opened this issue May 5, 2019 · 0 comments
Open

Specify when imported names become available #238

mattacosta opened this issue May 5, 2019 · 0 comments

Comments

@mattacosta
Copy link

The specification currently states that use declarations bring a name into a scope, but that's not exactly true, as imports are not available prior to the use declaration.

namespace A {
    class C {}
}
namespace B {
    // Same scope, 'A\C' should be available right?!
    $c = new C();
    use A\C;
}

Without this restriction, an engine could theoretically make an initial pass to import names from all use declarations, and therefore prevent a name resolution error from occurring.

18-namespaces.md

A namespace-use-declaration imports — that is, makes available — one or more names into a scope, optionally giving them each an alias.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant