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

remove reload #25207

Merged
merged 1 commit into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3388,7 +3388,8 @@ end
@deprecate indices(a, d) axes(a, d)

# PR #25046
export workspace
export reload, workspace
reload(name::AbstractString) = error("reload($(repr(name))) is discontinued, check out Revise.jl for an alternative workflow")
workspace() = error("workspace() is discontinued, check out Revise.jl for an alternative workflow")

# Issue #12902
Expand Down
1 change: 0 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,6 @@ export
evalfile,
include_string,
include_dependency,
reload,

# RTS internals
finalizer,
Expand Down
17 changes: 0 additions & 17 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,23 +288,6 @@ function __precompile__(isprecompilable::Bool=true)
end
end

"""
reload(name::AbstractString)

Force reloading of a package, even if it has been loaded before. This is intended for use
during package development as code is modified.
"""
function reload(name::AbstractString)
if contains(name, Filesystem.path_separator) || contains(name, ".")
# for reload("path/file.jl") just ask for include instead
error("use `include` instead of `reload` to load source files")
else
# reload("Package") is ok
unreference_module(Symbol(name))
require(Symbol(name))
end
end

# require always works in Main scope and loads files from node 1
const toplevel_load = Ref(true)

Expand Down
12 changes: 1 addition & 11 deletions doc/src/manual/workflow-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ line. A common pattern includes the following elements:
import Tmp
```

and includes tests for the contents of `Tmp`. The value of using `import` versus `using` is that
you can call `reload("Tmp")` instead of having to restart the REPL when your definitions change.
Of course, the cost is the need to prepend `Tmp.` to uses of names defined in your module. (You
can lower that cost by keeping your module name short.)

and includes tests for the contents of `Tmp`.
Alternatively, you can wrap the contents of your test file in a module, as

```
Expand All @@ -49,12 +45,6 @@ line. A common pattern includes the following elements:
`Tmp.` everywhere. The disadvantage is that code can no longer be selectively copied to the REPL
without some tweaking.
* **Lather. Rinse. Repeat.** Explore ideas at the `julia` command prompt. Save good ideas in `tst.jl`.
Occasionally restart the REPL, issuing

```julia
reload("Tmp")
include("tst.jl")
```

### Simplify initialization

Expand Down
1 change: 0 additions & 1 deletion doc/src/stdlib/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Base.less(::Any)
Base.@less
Base.clipboard(::Any)
Base.clipboard()
Base.reload
Base.require
Base.compilecache
Base.__precompile__
Expand Down
34 changes: 0 additions & 34 deletions test/compile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -321,25 +321,6 @@ try
fb_uuid1 = Base.module_uuid(FooBar1)
@test fb_uuid != fb_uuid1

reload("FooBar")
@test fb_uuid != Base.module_uuid(root_module(:FooBar))
@test fb_uuid1 == Base.module_uuid(FooBar1)
fb_uuid = Base.module_uuid(root_module(:FooBar))
@test isfile(joinpath(dir2, "FooBar.ji"))
@test Base.stale_cachefile(FooBar_file, joinpath(dir, "FooBar.ji")) === true
@test Base.stale_cachefile(FooBar1_file, joinpath(dir2, "FooBar1.ji")) isa Vector
@test Base.stale_cachefile(FooBar_file, joinpath(dir2, "FooBar.ji")) isa Vector

reload("FooBar1")
@test fb_uuid == Base.module_uuid(root_module(:FooBar))
@test fb_uuid1 != Base.module_uuid(root_module(:FooBar1))

@test isfile(joinpath(dir2, "FooBar.ji"))
@test isfile(joinpath(dir2, "FooBar1.ji"))
@test Base.stale_cachefile(FooBar_file, joinpath(dir, "FooBar.ji")) === true
@test Base.stale_cachefile(FooBar_file, joinpath(dir2, "FooBar.ji")) isa Vector
@test Base.stale_cachefile(FooBar1_file, joinpath(dir2, "FooBar1.ji")) isa Vector

# test checksum
open(joinpath(dir2, "FooBar1.ji"), "a") do f
write(f, 0x076cac96) # append 4 random bytes
Expand Down Expand Up @@ -548,21 +529,6 @@ let dir = mktempdir()
end
end

let module_name = string("a",randstring())
mktempdir() do path
unshift!(LOAD_PATH, path)
file_name = joinpath(path, string(module_name, ".jl"))
sleep(2)
touch(file_name)
code = """module $(module_name)\nend\n"""
write(file_name, code)
reload(module_name)
@test isa(root_module(Symbol(module_name)), Module)
@test shift!(LOAD_PATH) == path
rm(file_name)
end
end

# Issue #19960
let
test_workers = addprocs(1)
Expand Down