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

constant redefinition after workspace() fails on master under some circumstances #22434

Closed
simonster opened this issue Jun 19, 2017 · 4 comments · Fixed by #25046
Closed

constant redefinition after workspace() fails on master under some circumstances #22434

simonster opened this issue Jun 19, 2017 · 4 comments · Fixed by #25046
Labels
docs This change adds or pertains to documentation

Comments

@simonster
Copy link
Member

Consider:

const X = 1
workspace()
const X = []

On master, putting this in a file and running it results in an error (ERROR: LoadError: invalid redefinition of constant X), although pasting it into the REPL works. It works in both cases on 0.6.

This functionality was useful for package tests, but the docs do say that "This function should only be used interactively." However, I can also make it fail at the REPL if that is desired:

julia> const X = 1; workspace(); const X = []
ERROR: invalid redefinition of constant X
@simonster simonster added the docs This change adds or pertains to documentation label Jun 19, 2017
@simonster
Copy link
Member Author

simonster commented Jun 19, 2017

Labeling this as "doc" since @vtjnash says it is working as intended. (At the very least, since the change in behavior breaks existing code, it should probably be described in NEWS.)

@simonster simonster added needs news A NEWS entry is required for this change and removed needs news A NEWS entry is required for this change labels Jun 19, 2017
@vtjnash
Copy link
Member

vtjnash commented Jun 19, 2017

What else do you want it to document? As you noted, they already say it will only work interactively.

@simonster
Copy link
Member Author

I feel like any change that breaks actual existing code deserves a note in NEWS, if for no other reason that you can point people who realize that their code is broken to that note. In this case, I was using workspace() in some test code, and it would have been useful to know that the breakage was intended and can be worked around using @eval Core.Main ... after workspace().

@simonster
Copy link
Member Author

Also worth noting that, on master but not 0.6, constant redefinition after workspace() appears to be totally broken in IJulia:

screen shot 2017-06-21 at 1 53 56 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants