There is one alternative that I don’t think has been raised yet: parameterize
import. If it looked like a method with a single implicit parameter, then you could
The disadvantage of this is that
import is not a method,
absolute should not actually be in the symbol table in scope, and even if it was a method you can’t pass arguments after a method name without parens.
The advantage, however, is that it’s extremely obvious what is going on because
) are not valid package names and visually separate the behavioral “parameter” from the imports, and because you can choose names that are actually meaningful in context. Furthermore, it’s possible to define more than two, if you want; so far we have discussed three behaviors (relative, absolute, and preferAbsolute). But there are others. For instance, you might want to import only symbols that aren’t already in the table, e.g.
import(ifMissing) java.util._ to avoid shadowing