Skip to content

Commit

Permalink
more predictable global binding resolution
Browse files Browse the repository at this point in the history
fix #18933
fix #17387 (for the syntactic case)
  • Loading branch information
vtjnash committed Jul 28, 2017
1 parent 04d76f3 commit 9a0073d
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 236 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ Language changes
* The parsing of `1<<2*3` as `1<<(2*3)` is deprecated, and will change to
`(1<<2)*3` in a future version ([#13079]).

* The `global` keyword now always introduces a new binding when appearing in toplevel (global) scope.
Whereas, previously, embedding it in a block (such as `begin; global sin; nothing; end`) would change its meaning.
Additionally, the new bindings are now created before the statement is executed.
For example, `f() = (global sin = rand(); nothing)` will now reliably shadow the `Base.sin` function,
with a new, undefined `sin` variable. ([#22984]).


Breaking changes
----------------

Expand Down
3 changes: 1 addition & 2 deletions base/poll.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ mutable struct _FDWatcher
end
end

global uvfinalize
function uvfinalize(t::_FDWatcher)
function Base.uvfinalize(t::_FDWatcher)
if t.handle != C_NULL
disassociate_julia_struct(t)
ccall(:jl_close_uv, Void, (Ptr{Void},), t.handle)
Expand Down
152 changes: 0 additions & 152 deletions doc/make.jl
Original file line number Diff line number Diff line change
@@ -1,152 +0,0 @@
# Install dependencies needed to build the documentation.
ENV["JULIA_PKGDIR"] = joinpath(@__DIR__, "deps")
Pkg.init()
cp(joinpath(@__DIR__, "REQUIRE"), Pkg.dir("REQUIRE"); remove_destination = true)
Pkg.update()
Pkg.resolve()

using Documenter

# Include the `build_sysimg` file.

baremodule GenStdLib end
isdefined(:build_sysimg) || @eval module BuildSysImg
include(joinpath(@__DIR__, "..", "contrib", "build_sysimg.jl"))
end

# Documenter Setup.

const PAGES = [
"Home" => "index.md",
"Manual" => [
"manual/introduction.md",
"manual/getting-started.md",
"manual/variables.md",
"manual/integers-and-floating-point-numbers.md",
"manual/mathematical-operations.md",
"manual/complex-and-rational-numbers.md",
"manual/strings.md",
"manual/functions.md",
"manual/control-flow.md",
"manual/variables-and-scoping.md",
"manual/types.md",
"manual/methods.md",
"manual/constructors.md",
"manual/conversion-and-promotion.md",
"manual/interfaces.md",
"manual/modules.md",
"manual/documentation.md",
"manual/metaprogramming.md",
"manual/arrays.md",
"manual/linear-algebra.md",
"manual/networking-and-streams.md",
"manual/parallel-computing.md",
"manual/dates.md",
"manual/interacting-with-julia.md",
"manual/running-external-programs.md",
"manual/calling-c-and-fortran-code.md",
"manual/handling-operating-system-variation.md",
"manual/environment-variables.md",
"manual/embedding.md",
"manual/packages.md",
"manual/profile.md",
"manual/stacktraces.md",
"manual/performance-tips.md",
"manual/workflow-tips.md",
"manual/style-guide.md",
"manual/faq.md",
"manual/noteworthy-differences.md",
"manual/unicode-input.md",
],
"Standard Library" => [
"stdlib/base.md",
"stdlib/collections.md",
"stdlib/math.md",
"stdlib/numbers.md",
"stdlib/strings.md",
"stdlib/arrays.md",
"stdlib/parallel.md",
"stdlib/linalg.md",
"stdlib/constants.md",
"stdlib/file.md",
"stdlib/io-network.md",
"stdlib/punctuation.md",
"stdlib/sort.md",
"stdlib/pkg.md",
"stdlib/dates.md",
"stdlib/iterators.md",
"stdlib/test.md",
"stdlib/c.md",
"stdlib/libc.md",
"stdlib/libdl.md",
"stdlib/profile.md",
"stdlib/stacktraces.md",
"stdlib/simd-types.md",
],
"Developer Documentation" => [
"devdocs/reflection.md",
"Documentation of Julia's Internals" => [
"devdocs/init.md",
"devdocs/ast.md",
"devdocs/types.md",
"devdocs/object.md",
"devdocs/eval.md",
"devdocs/callconv.md",
"devdocs/compiler.md",
"devdocs/functions.md",
"devdocs/cartesian.md",
"devdocs/meta.md",
"devdocs/subarrays.md",
"devdocs/sysimg.md",
"devdocs/llvm.md",
"devdocs/stdio.md",
"devdocs/boundscheck.md",
"devdocs/locks.md",
"devdocs/offset-arrays.md",
"devdocs/libgit2.md",
"devdocs/require.md",
"devdocs/inference.md",
],
"Developing/debugging Julia's C code" => [
"devdocs/backtraces.md",
"devdocs/debuggingtips.md",
"devdocs/valgrind.md",
"devdocs/sanitizers.md",
]
],
]

makedocs(
build = joinpath(pwd(), "_build/html/en"),
modules = [Base, Core, BuildSysImg],
clean = false,
doctest = "doctest" in ARGS,
linkcheck = "linkcheck" in ARGS,
linkcheck_ignore = ["https://bugs.kde.org/show_bug.cgi?id=136779"], # fails to load from nanosoldier?
strict = true,
checkdocs = :none,
format = "pdf" in ARGS ? :latex : :html,
sitename = "The Julia Language",
authors = "The Julia Project",
analytics = "UA-28835595-6",
pages = PAGES,
html_prettyurls = ("deploy" in ARGS),
)

if "deploy" in ARGS
# Only deploy docs from 64bit Linux to avoid committing multiple versions of the same
# docs from different workers.
(Sys.ARCH === :x86_64 && Sys.KERNEL === :Linux) || return

# Since the `.travis.yml` config specifies `language: cpp` and not `language: julia` we
# need to manually set the version of Julia that we are deploying the docs from.
ENV["TRAVIS_JULIA_VERSION"] = "nightly"

deploydocs(
repo = "github.com/JuliaLang/julia.git",
target = "_build/html/en",
dirname = "en",
deps = nothing,
make = nothing,
)
end
16 changes: 0 additions & 16 deletions src/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,22 +319,6 @@ static jl_value_t *eval(jl_value_t *e, interpreter_state *s)
jl_declare_constant(b);
return (jl_value_t*)jl_nothing;
}
else if (ex->head == global_sym) {
// create uninitialized mutable binding for "global x" decl
// TODO: handle type decls
size_t i, l = jl_array_len(ex->args);
for (i = 0; i < l; i++) {
jl_sym_t *gsym = (jl_sym_t*)args[i];
jl_module_t *gmodu = modu;
if (jl_is_globalref(gsym)) {
gmodu = jl_globalref_mod(gsym);
gsym = jl_globalref_name(gsym);
}
assert(jl_is_symbol(gsym));
jl_get_binding_wr(gmodu, gsym);
}
return (jl_value_t*)jl_nothing;
}
else if (ex->head == abstracttype_sym) {
if (inside_typedef)
jl_error("cannot eval a new abstract type definition while defining another type");
Expand Down
Loading

0 comments on commit 9a0073d

Please sign in to comment.