@@ -103,14 +103,13 @@ function firstcaller(bt::Array{Ptr{Void},1}, funcsyms)
103103 return lkup
104104end
105105
106- deprecate (s:: Symbol ) = deprecate (current_module (), s)
107106deprecate (m:: Module , s:: Symbol ) = ccall (:jl_deprecate_binding , Void, (Any, Any), m, s)
108107
109108macro deprecate_binding (old, new, export_old= true )
110- Expr (:toplevel ,
109+ return Expr (:toplevel ,
111110 export_old ? Expr (:export , esc (old)) : nothing ,
112111 Expr (:const , Expr (:(= ), esc (old), esc (new))),
113- Expr (:call , :deprecate , Expr (:quote , old)))
112+ Expr (:call , :deprecate , __module__, Expr (:quote , old)))
114113end
115114
116115# BEGIN 0.6-alpha deprecations (delete when 0.6 is released)
@@ -630,7 +629,7 @@ for (Bsig, A1sig, A2sig, gbb, funcname) in
630629 func = @get! cache f gen_broadcast_function_sparse ($ gbb, f, ($ A1sig) <: SparseMatrixCSC )
631630 # need eval because func was just created by gen_broadcast_function_sparse
632631 # TODO : convert this to a generated function
633- eval (current_module (), Expr (:body , Expr (:return , Expr (:call , QuoteNode (func), QuoteNode (B), QuoteNode (A1), QuoteNode (A2)))))
632+ eval (_current_module (), Expr (:body , Expr (:return , Expr (:call , QuoteNode (func), QuoteNode (B), QuoteNode (A1), QuoteNode (A2)))))
634633 return B
635634 end
636635 end # let broadcast_cache
@@ -1348,6 +1347,43 @@ end
13481347@deprecate srand (filename:: AbstractString , n:: Integer = 4 ) srand (read! (filename, Array {UInt32} (Int (n))))
13491348@deprecate MersenneTwister (filename:: AbstractString ) srand (MersenneTwister (0 ), read! (filename, Array {UInt32} (Int (4 ))))
13501349
1350+ _current_module () = ccall (:jl_get_current_module , Ref{Module}, ())
1351+ @noinline function binding_module (s:: Symbol )
1352+ depwarn (" binding_module(symbol) is deprecated, use `binding_module(__module__, symbol)` instead." , :binding_module )
1353+ return binding_module (_current_module (), s)
1354+ end
1355+ @noinline function expand (x:: ANY )
1356+ depwarn (" expand(x) is deprecated, use `expand(__module__, x)` instead." , :expand )
1357+ return expand (_current_module (), x)
1358+ end
1359+ @noinline function macroexpand (x:: ANY )
1360+ depwarn (" macroexpand(x) is deprecated, use `macroexpand(__module__, x)` instead." , :macroexpand )
1361+ return macroexpand (_current_module (), x)
1362+ end
1363+ @noinline function isconst (s:: Symbol )
1364+ depwarn (" isconst(symbol) is deprecated, use `isconst(__module__, symbol)` instead." , :isconst )
1365+ return isconst (_current_module (), s)
1366+ end
1367+ @noinline function include_string (txt:: AbstractString , fname:: AbstractString )
1368+ depwarn (" include_string(string, fname) is deprecated, use `include_string(__module__, string, fname)` instead." , :include_string )
1369+ return include_string (_current_module (), txt, fname)
1370+ end
1371+
1372+ """
1373+ current_module() -> Module
1374+
1375+ Get the *dynamically* current `Module`, which is the `Module` code is currently being read
1376+ from. In general, this is not the same as the module containing the call to this function.
1377+
1378+ DEPRECATED: use @__MODULE__ instead
1379+ """
1380+ @noinline function current_module ()
1381+ depwarn (" current_module() is deprecated, use `@__MODULE__` instead." , :current_module )
1382+ return _current_module ()
1383+ end
1384+ export current_module
1385+
1386+
13511387# END 0.7 deprecations
13521388
13531389# BEGIN 1.0 deprecations
0 commit comments