Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser errors and using #3648

Closed
Keno opened this issue Jul 8, 2013 · 7 comments
Closed

Parser errors and using #3648

Keno opened this issue Jul 8, 2013 · 7 comments
Labels
design Design of APIs or of the language itself
Milestone

Comments

@Keno
Copy link
Member

Keno commented Jul 8, 2013

Consider the following:

foo.jl

module Foo
using Bar
end

bar.jl

module Bar
.
end
julia> using Bar
ERROR: syntax: invalid identifier name .
 in include_from_node1 at loading.jl:91
 in reload_path at loading.jl:114
 in require at loading.jl:48
at /Users/keno/Documents/src/julia/Bar.jl:1

julia> using Bar
ERROR: syntax: invalid identifier name .
 in include_from_node1 at loading.jl:91
 in reload_path at loading.jl:114
 in require at loading.jl:48
at /Users/keno/Documents/src/julia/Bar.jl:1

julia> using Foo
ERROR: syntax: invalid identifier name .
 in include_from_node1 at loading.jl:91
 in reload_path at loading.jl:114
 in require at loading.jl:48
 in include_from_node1 at loading.jl:91
 in reload_path at loading.jl:114
 in require at loading.jl:48
at /Users/keno/Documents/src/julia/Bar.jl:1
at /Users/keno/Documents/src/julia/Foo.jl:2

julia> using Foo

julia>

We already try to do this but in cases like the Foo module above, we just get a partially evaluated foo module. Ideally this should fail in the same way the second time.

@JeffBezanson
Copy link
Sponsor Member

What should the following do:

module Foo
a = 1
error()
b = 2
end

?

@Keno
Copy link
Member Author

Keno commented Jul 10, 2013

probably not bind the module Foo. I find it really bad to have a partially evaluated module, but I'm not sure.

@JeffBezanson
Copy link
Sponsor Member

I agree that it is bad, but you might want to debug the error. I guess there is much to be said for doing as little as possible during module load time.

@Keno
Copy link
Member Author

Keno commented Jul 10, 2013

alight, how about this then. If you explicitly include something you get a partially evaluated module, but if you just say using Foo, you don't. Not sure how feasible that is.

@JeffBezanson
Copy link
Sponsor Member

It's probably feasible, but people also do using programmatically (via macros or eval), so it's hard to make a distinction between what results in throwing out the module and what doesn't. The module might also have added methods to functions in other modules. This is a reason to prefer a more static using; for example if all using statements had to occur before any other expressions then this would be easy to deal with.

I wish we had a better solution for conditional using; it's really only a load-time thing and won't work at init time or run time, so the usingmodule function is excessive.

@StefanKarpinski StefanKarpinski added design Design of APIs or of the language itself and removed needs decision A decision on this change is needed labels Sep 13, 2016
@StefanKarpinski StefanKarpinski added this to the 0.6.0 milestone Sep 13, 2016
@StefanKarpinski StefanKarpinski modified the milestones: 1.0, 0.6.0 Nov 10, 2016
@StefanKarpinski
Copy link
Sponsor Member

This seems non-breaking since it only affects behavior when code is broken anyway.

@Keno
Copy link
Member Author

Keno commented Jul 27, 2017

Between precompilation and Revise, this is not an issue any more in day-to-day work.

@Keno Keno closed this as completed Jul 27, 2017
KristofferC pushed a commit that referenced this issue Oct 17, 2023
Stdlib: Pkg
URL: https://github.com/JuliaLang/Pkg.jl.git
Stdlib branch: master
Julia branch: master
Old commit: b02fb9597
New commit: ffb6edf03
Julia version: 1.11.0-DEV
Pkg version: 1.11.0
Bump invoked by: @IanButterworth
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaLang/Pkg.jl@b02fb95...ffb6edf

```
$ git log --oneline b02fb9597..ffb6edf03
ffb6edf03 cache pidlock tweaks (#3654)
550eadd7e Pin registry for MetaGraph tests (#3666)
ee39026b8 Remove test that depends on Random being in the sysimg (#3656)
561508db2 CI: Increase the CI timeout. Update actions. Fix double precompilation. (#3665)
7c7ed63b1 Remove change UUID script it should be uncessary on Julia v1.11-dev (#3655)
a8648f7c8 Precompile: Fix algorithmic complexity of cycle detection (#3651)
0e0cf4514 Switch datastructure Vector -> Set for algorithmic complexity (#3652)
894cc3f78 respect if load-time precompile is disabled (#3648)
3ffd1cf73 Make auto GC message use printpkgstyle (#3633)
```

Co-authored-by: Dilum Aluthge <dilum@aluthge.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design of APIs or of the language itself
Projects
None yet
Development

No branches or pull requests

3 participants