IssueRaiser

2.0: just one import keyword

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 https://github.com/JuliaLang/julia/issues/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.

Posted by StefanKarpinski on Jan 13, 2021, 8:11 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

github (Software)

2.0: just one import keyword

StefanKarpinskiJan 13, 2021, 8:11 PM

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 https://github.com/JuliaLang/julia/issues/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.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue