Skip to content

Commit

Permalink
Merge pull request #25207 from JuliaLang/sk/xreload
Browse files Browse the repository at this point in the history
remove reload
  • Loading branch information
vchuravy authored Dec 21, 2017
2 parents fa856bb + 23362c0 commit d24ccd4
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 65 deletions.
3 changes: 2 additions & 1 deletion base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3391,7 +3391,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

0 comments on commit d24ccd4

Please sign in to comment.