@@ -103,7 +103,7 @@ function firstcaller(bt::Array{Ptr{Void},1}, funcsyms)
103
103
return lkup
104
104
end
105
105
106
- deprecate (m:: Module , s:: Symbol ) = ccall (:jl_deprecate_binding , Void, (Any, Any), m, s)
106
+ deprecate (m:: Module , s:: Symbol , flag = 1 ) = ccall (:jl_deprecate_binding , Void, (Any, Any, Cint ), m, s, flag )
107
107
108
108
macro deprecate_binding (old, new, export_old= true )
109
109
return Expr (:toplevel ,
@@ -112,6 +112,18 @@ macro deprecate_binding(old, new, export_old=true)
112
112
Expr (:call , :deprecate , __module__, Expr (:quote , old)))
113
113
end
114
114
115
+ macro deprecate_moved (old, new, export_old= true )
116
+ eold = esc (old)
117
+ return Expr (:toplevel ,
118
+ :(function $eold (args... ; kwargs... )
119
+ error ($ eold, " has been moved to the package " , $ new, " .jl.\n " ,
120
+ " Run `Pkg.add(\" " , $ new, " \" )` to install it, restart Julia,\n " ,
121
+ " and then run `using " , $ new, " ` to load it." )
122
+ end ),
123
+ export_old ? Expr (:export , eold) : nothing ,
124
+ Expr (:call , :deprecate , __module__, Expr (:quote , old), 2 ))
125
+ end
126
+
115
127
# BEGIN 0.6-alpha deprecations (delete when 0.6 is released)
116
128
117
129
@deprecate isambiguous (m1:: Method , m2:: Method , b:: Bool ) isambiguous (m1, m2, ambiguous_bottom= b) false
@@ -684,21 +696,12 @@ end
684
696
@deprecate xor (A:: AbstractArray , B:: AbstractArray ) xor .(A, B)
685
697
686
698
# QuadGK moved to a package (#19741)
687
- function quadgk (args... ; kwargs... )
688
- error (string (quadgk, args, " has been moved to the package QuadGK.jl.\n " ,
689
- " Run Pkg.add(\" QuadGK\" ) to install QuadGK on Julia v0.6 and later, and then run `using QuadGK`." ))
690
- end
691
- export quadgk
699
+ @deprecate_moved quadgk " QuadGK"
692
700
693
701
# Collections functions moved to a package (#19800)
694
702
module Collections
695
- export PriorityQueue, enqueue!, dequeue!, heapify!, heapify, heappop!, heappush!, isheap, peek
696
703
for f in (:PriorityQueue , :enqueue! , :dequeue! , :heapify! , :heapify , :heappop! , :heappush! , :isheap , :peek )
697
- @eval function ($ f)(args... ; kwargs... )
698
- error (string ($ f, args, " has been moved to the package DataStructures.jl.\n " ,
699
- " Run Pkg.add(\" DataStructures\" ) to install DataStructures on Julia v0.6 and later, " ,
700
- " and then run `using DataStructures`." ))
701
- end
704
+ @eval Base. @deprecate_moved $ f " DataStructures"
702
705
end
703
706
end
704
707
export Collections
@@ -1288,14 +1291,7 @@ for f in (:airyai, :airyaiprime, :airybi, :airybiprime, :airyaix, :airyaiprimex,
1288
1291
:eta , :zeta , :digamma , :invdigamma , :polygamma , :trigamma ,
1289
1292
:hankelh1 , :hankelh1x , :hankelh2 , :hankelh2x ,
1290
1293
:airy , :airyx , :airyprime )
1291
- @eval begin
1292
- function $f (args... ; kwargs... )
1293
- error (string ($ f, args, " has been moved to the package SpecialFunctions.jl.\n " ,
1294
- " Run Pkg.add(\" SpecialFunctions\" ) to install SpecialFunctions on Julia v0.6 and later,\n " ,
1295
- " and then run `using SpecialFunctions`." ))
1296
- end
1297
- export $ f
1298
- end
1294
+ @eval @deprecate_moved $ f " SpecialFunctions"
1299
1295
end
1300
1296
1301
1297
@deprecate_binding LinearIndexing IndexStyle false
@@ -1443,43 +1439,22 @@ module DFT
1443
1439
:plan_dct , :plan_dct! , :plan_fft , :plan_fft! , :plan_idct , :plan_idct! ,
1444
1440
:plan_ifft , :plan_ifft! , :plan_irfft , :plan_rfft , :rfft ]
1445
1441
pkg = endswith (String (f), " shift" ) ? " AbstractFFTs" : " FFTW"
1446
- @eval begin
1447
- function $f (args... ; kwargs... )
1448
- error ($ f, " has been moved to the package $($ pkg) .jl.\n " ,
1449
- " Run `Pkg.add(\" $($ pkg) \" )` to install $($ pkg) then run `using $($ pkg) ` " ,
1450
- " to load it." )
1451
- end
1452
- export $ f
1453
- end
1442
+ @eval Base. @deprecate_moved $ f $ pkg
1454
1443
end
1455
1444
module FFTW
1456
1445
for f in [:r2r , :r2r! , :plan_r2r , :plan_r2r! ]
1457
- @eval begin
1458
- function $f (args... ; kwargs... )
1459
- error ($ f, " has been moved to the package FFTW.jl.\n " ,
1460
- " Run `Pkg.add(\" FFTW\" )` to install FFTW then run `using FFTW` " ,
1461
- " to load it." )
1462
- end
1463
- export $ f
1464
- end
1446
+ @eval Base. @deprecate_moved $ f " FFTW"
1465
1447
end
1466
1448
end
1467
1449
export FFTW
1468
1450
end
1469
1451
using . DFT
1470
- for f in names (DFT)
1452
+ for f in filter (s -> isexported (DFT, s), names (DFT, true ) )
1471
1453
@eval export $ f
1472
1454
end
1473
1455
module DSP
1474
1456
for f in [:conv , :conv2 , :deconv , :filt , :filt! , :xcorr ]
1475
- @eval begin
1476
- function $f (args... ; kwargs... )
1477
- error ($ f, " has been moved to the package DSP.jl.\n " ,
1478
- " Run `Pkg.add(\" DSP\" )` to install DSP then run `using DSP` " ,
1479
- " to load it." )
1480
- end
1481
- export $ f
1482
- end
1457
+ @eval Base. @deprecate_moved $ f " DSP"
1483
1458
end
1484
1459
end
1485
1460
using . DSP
0 commit comments