diff --git a/base/blas.jl b/base/blas.jl index 89e993707fa43..31ab320ddc6a1 100644 --- a/base/blas.jl +++ b/base/blas.jl @@ -1,7 +1,6 @@ typealias LapackType Union(Float64,Float32,Complex128,Complex64) module BLAS -using Base export copy!, scal!, diff --git a/base/dsp.jl b/base/dsp.jl index 3ce571442c28d..1d3e1a3916c87 100644 --- a/base/dsp.jl +++ b/base/dsp.jl @@ -1,6 +1,5 @@ module DSP -using Base using Base.FFTW export FFTW, filt, deconv, conv, conv2, xcorr, fftshift, ifftshift, diff --git a/base/fftw.jl b/base/fftw.jl index 500dcd69bdcd5..c0c38771fb877 100644 --- a/base/fftw.jl +++ b/base/fftw.jl @@ -1,7 +1,5 @@ module FFTW -using Base - export bfft, bfftn, brfft, brfftn, fft, fft2, fft3, fftn, ifft, ifft2, ifft3, ifftn, irfft, irfftn, rfft, rfftn diff --git a/base/git.jl b/base/git.jl index 7e5aee110004e..d671bc7327fd2 100644 --- a/base/git.jl +++ b/base/git.jl @@ -3,8 +3,6 @@ module Git # some utility functions for working with git repos # -using Base - dir() = readchomp(`git rev-parse --git-dir`) modules(args::Cmd) = readchomp(`git config -f .gitmodules $args`) different(verA::String, verB::String, path::String) = diff --git a/base/grisu.jl b/base/grisu.jl index f89a888f8965d..1ff47b55eb90b 100644 --- a/base/grisu.jl +++ b/base/grisu.jl @@ -1,5 +1,4 @@ module Grisu -using Base export print_shortest export @grisu_ccall, NEG, DIGITS, BUFLEN, LEN, POINT diff --git a/base/lapack.jl b/base/lapack.jl index 1458c9e47842d..89dfb5a509cd5 100644 --- a/base/lapack.jl +++ b/base/lapack.jl @@ -1,6 +1,5 @@ ## The LAPACK module of interfaces to LAPACK subroutines module LAPACK -using Base liblapack = Base.liblapack_name diff --git a/base/librandom.jl b/base/librandom.jl index 22fb43c7251c1..ad66cb454edfa 100644 --- a/base/librandom.jl +++ b/base/librandom.jl @@ -1,7 +1,5 @@ module LibRandom -using Base - export DSFMT_state, dsfmt_get_min_array_size, dsfmt_get_idstring, dsfmt_init_gen_rand, dsfmt_gv_init_gen_rand, dsfmt_init_by_array, dsfmt_gv_init_by_array, diff --git a/base/math.jl b/base/math.jl index 5b8f836dd5396..a3d0a7e2ce352 100644 --- a/base/math.jl +++ b/base/math.jl @@ -1,7 +1,5 @@ module Math -using Base - export sin, cos, tan, sinh, cosh, tanh, asin, acos, atan, asinh, acosh, atanh, sec, csc, cot, asec, acsc, acot, sech, csch, coth, asech, acsch, acoth, sinc, cosc, diff --git a/base/pcre.jl b/base/pcre.jl index 3a5d462f4774d..7273d3d5818b9 100644 --- a/base/pcre.jl +++ b/base/pcre.jl @@ -1,7 +1,6 @@ ## low-level pcre interface ## module PCRE -using Base include("pcre_h.jl") diff --git a/base/pkg.jl b/base/pkg.jl index dc7d0cf4f313f..1356968e7489a 100644 --- a/base/pkg.jl +++ b/base/pkg.jl @@ -6,7 +6,6 @@ module Pkg # Julia's git-based declarative package manager # -using Base using Metadata import Git diff --git a/base/pkgmetadata.jl b/base/pkgmetadata.jl index 7a6fb92438d3d..6e527d09daea0 100644 --- a/base/pkgmetadata.jl +++ b/base/pkgmetadata.jl @@ -2,7 +2,6 @@ require("linprog") module Metadata -using Base using LinProgGLPK import Git diff --git a/base/printf.jl b/base/printf.jl index d7b133dc0871e..1dc1e51672a39 100644 --- a/base/printf.jl +++ b/base/printf.jl @@ -1,5 +1,4 @@ module Printf -using Base using Base.Grisu export @printf, @sprintf diff --git a/base/rng.jl b/base/rng.jl index 5c562a569d972..47877e09f7201 100644 --- a/base/rng.jl +++ b/base/rng.jl @@ -1,6 +1,5 @@ module RNG -using Base using Base.LibRandom export librandom_init, srand, diff --git a/base/sysimg.jl b/base/sysimg.jl index 0f41bd2e66809..aa7b42621422c 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -1,4 +1,4 @@ -module Base +baremodule Base include("export.jl") @@ -270,7 +270,7 @@ begin typeinf_ext(minf[1][3], atypes, (), minf[1][3]) end -end # module Base +end # baremodule Base using Base diff --git a/contrib/julia-mode.el b/contrib/julia-mode.el index c4e1b448c6d5c..d9d1984bd9a7f 100644 --- a/contrib/julia-mode.el +++ b/contrib/julia-mode.el @@ -69,7 +69,8 @@ '("if" "else" "elseif" "while" "for" "begin" "end" "quote" "try" "catch" "return" "local" "abstract" "function" "macro" "ccall" "finally" "typealias" "break" "continue" "type" "global" "@\\w+" - "module" "using" "import" "export" "const" "let" "bitstype" "do") + "module" "using" "import" "export" "const" "let" "bitstype" "do" + "baremodule" "importall") "\\|") "\\)\\>") 'font-lock-keyword-face) '("\\<\\(true\\|false\\|C_NULL\\|Inf\\|NaN\\|Inf32\\|NaN32\\|nothing\\)\\>" . font-lock-constant-face) diff --git a/contrib/julia.xml b/contrib/julia.xml index ea952c879168a..52a106fd7a7ed 100644 --- a/contrib/julia.xml +++ b/contrib/julia.xml @@ -62,10 +62,12 @@ export global import + importall in local macro module + baremodule return typealias diff --git a/examples/bigfib.jl b/examples/bigfib.jl index e7266e7000d0d..e182fb37efbfb 100644 --- a/examples/bigfib.jl +++ b/examples/bigfib.jl @@ -1,7 +1,6 @@ require("extras/bigint") module BigFib -using Base export bigfib const BigInt = Main.BigInt diff --git a/extras/arpack.jl b/extras/arpack.jl index 40c69d7192578..b0a13a204a593 100644 --- a/extras/arpack.jl +++ b/extras/arpack.jl @@ -4,7 +4,6 @@ require("linalg_sparse") ## SparseMatrixCSC is not defined even after the require("sparse") #module ARPACK -#using Base #export eigs, svds _jl_libarpack = dlopen("libarpack") diff --git a/extras/glpk.jl b/extras/glpk.jl index ff7980e5650d7..7696aab9351e6 100644 --- a/extras/glpk.jl +++ b/extras/glpk.jl @@ -5,7 +5,6 @@ require("sparse") module GLPK -using Base export # Types diff --git a/extras/gzip.jl b/extras/gzip.jl index 17e7e5e4c8949..040226c8c318a 100644 --- a/extras/gzip.jl +++ b/extras/gzip.jl @@ -1,7 +1,6 @@ ## gzip file io ## module GZip -using Base import Base.show, Base.fd, Base.close, Base.flush, Base.truncate, Base.seek import Base.skip, Base.position, Base.eof, Base.read, Base.readall diff --git a/extras/linprog.jl b/extras/linprog.jl index cfea85c9530e4..58675a7a19c49 100644 --- a/extras/linprog.jl +++ b/extras/linprog.jl @@ -6,7 +6,6 @@ require("glpk") module LinProgGLPK -using Base import GLPK diff --git a/extras/profile.jl b/extras/profile.jl index 79b6827b29355..b67d1f46c2487 100644 --- a/extras/profile.jl +++ b/extras/profile.jl @@ -1,5 +1,4 @@ module Profile -using Base PROFILE_LINES = 1 PROFILE_DESCEND = 2 diff --git a/extras/suitesparse.jl b/extras/suitesparse.jl index a485639a6efe9..1bede7d517cfd 100644 --- a/extras/suitesparse.jl +++ b/extras/suitesparse.jl @@ -1,7 +1,6 @@ require("linalg_sparse") #module Suitesparse -#using Base #import Base.SparseMatrixCSC import Base.size, Base.nnz, Base.eltype, Base.show diff --git a/extras/zlib.jl b/extras/zlib.jl index 24f6ddccb1054..aa90d343b816a 100644 --- a/extras/zlib.jl +++ b/extras/zlib.jl @@ -1,5 +1,4 @@ module Zlib -using Base export # Compression routines diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 354c9466d5806..5c742259ec212 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -87,8 +87,8 @@ (define reserved-words '(begin while if for try return break continue function macro quote let local global const - abstract typealias type bitstype - module using import export ccall do)) + abstract typealias type bitstype ccall do + module baremodule using import export importall)) (define (syntactic-op? op) (memq op syntactic-operators)) (define (syntactic-unary-op? op) (memq op syntactic-unary-operators)) @@ -943,9 +943,9 @@ (eq? (car assgn) 'local)))) (error "expected assignment after const") `(const ,assgn)))) - ((module) + ((module baremodule) (let ((name (parse-atom s))) - (begin0 (list word name (parse-block s)) + (begin0 (list 'module (eq? word 'module) name (parse-block s)) (expect-end s)))) ((export) (let ((es (map macrocall-to-atsym diff --git a/src/toplevel.c b/src/toplevel.c index 3961a970ad191..a9e71ab388899 100644 --- a/src/toplevel.c +++ b/src/toplevel.c @@ -31,7 +31,8 @@ jl_value_t *jl_eval_module_expr(jl_expr_t *ex) { assert(ex->head == module_sym); jl_module_t *last_module = jl_current_module; - jl_sym_t *name = (jl_sym_t*)jl_exprarg(ex, 0); + int std_imports = (jl_exprarg(ex,0)==jl_true); + jl_sym_t *name = (jl_sym_t*)jl_exprarg(ex, 1); if (!jl_is_symbol(name)) { jl_type_error("module", (jl_value_t*)jl_sym_type, (jl_value_t*)name); } @@ -52,10 +53,17 @@ jl_value_t *jl_eval_module_expr(jl_expr_t *ex) // export all modules from Main if (parent_module == jl_main_module) jl_module_export(jl_main_module, name); + + // add standard imports unless baremodule + if (std_imports) { + if (jl_base_module != NULL) + jl_module_using(newm, jl_base_module); // using Base + } + JL_GC_PUSH(&last_module); jl_current_module = newm; - jl_array_t *exprs = ((jl_expr_t*)jl_exprarg(ex, 1))->args; + jl_array_t *exprs = ((jl_expr_t*)jl_exprarg(ex, 2))->args; JL_TRY { for(int i=0; i < exprs->length; i++) { // process toplevel form