Open
Description
I would very much like to have just one import keyword in Julia 2.0. I don't much care if it's import
or using
but since we talk about it as "importing" things, that may be more natural. With #39187 and some requirement for explicitly requesting extension of external generic functions, this would be possible.
current form | new form | comment |
---|---|---|
import Foo |
import Foo |
just imports Foo |
import Foo: Foo, bar |
import Foo: bar |
in 2.0 import Foo: bar imports Foo also |
import Foo: bar |
import Foo as _: bar |
use Foo as _ to discard that name |
using Foo |
import Foo... |
|
using Foo |
import Foo: ... |
longer version of the previous one |
using Foo; using Foo: bar |
import Foo: bar, ... |
implicit and explicit imports on one line |
using Foo as _ |
import Foo as _: ... |
use Foo as _ to discard that name |
In 2.0 I think we should eliminate the distinction between the "soft binding" that using
creates and the hard binding that import
creates and just make all explicit bindings hard and all implicit bindings soft: if you asked for it by name, it's a hard binding, if you didn't, it's a soft binding. When someone wants to extend an implicitly imported generic function, they have to fully qualify it.