Phase 5: Compiler Integration — RFC #218
Implement aliased imports (use mux "github.com/user/router") so users can rename packages on import. The alias becomes the local symbol name instead of the last path segment.
Closes #221.
Example
use mux "github.com/user/router" // use as: mux.Handle(...)
use "github.com/user/repo/auth" // use as: auth.Verify(...)
Acceptance Criteria
- Parser accepts
use <ident> <string> syntax
- Alias identifier becomes the package symbol name
- Original path is still used for resolution
- Non-aliased imports continue to work unchanged
- Error if alias conflicts with another import name
- Tests for aliased and non-aliased imports
Files
- Modified:
src/parser.zig (new import syntax)
- Modified:
src/ast.zig (potentially new node variant)
- Modified:
src/resolve.zig
Dependencies
Independent of multi-file compilation (#314-316).
Part of the Package Manager RFC.
Phase 5: Compiler Integration — RFC #218
Implement aliased imports (
use mux "github.com/user/router") so users can rename packages on import. The alias becomes the local symbol name instead of the last path segment.Closes #221.
Example
Acceptance Criteria
use <ident> <string>syntaxFiles
src/parser.zig(new import syntax)src/ast.zig(potentially new node variant)src/resolve.zigDependencies
Independent of multi-file compilation (#314-316).
Part of the Package Manager RFC.