Skip to content

Specify when imported names become available #238

@mattacosta

Description

@mattacosta

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions