Language Devel / DIPs /
Provide a language construct to declare import paths in source files.
Declaring the location of dependencies should be done at the place where the dependency occurs. This reduces redundancy and maintenance effort. This is a requirement for DIP11.
The specification for ImportDeclaration is extended as follows.
This will not add a symbol bar to the current scope.
Allowing an expression as module name does conflict with import bindings and alias imports.
It was proposed in DIP11 to add a new pragma(importpath, "ImportSpec") with the same rules as giving a command line import path.
This has two drawbacks. First one would need to statements to import a module.
Second using a pragma needs scoping rules. It was proposed that pragma(importpath) only be valid for that particular module. This has maintenance issues as every import from that path and the imported source themselves need to be kept in sync. One would need additional means to selectively transfer the import path to other modules.
This document has been placed in the Public Domain.