-
Local variables can be tested for being defined using the new
@isdefined variable
macro (#22281). -
Destructuring in function arguments: when an expression such as
(x, y)
is used as a function argument name, the argument is unpacked into local variablesx
andy
as in the assignment(x, y) = arg
(#6614). -
Named tuples, with the syntax
(a=1, b=2)
. These behave very similarly to tuples, except components can also be accessed by name using dot syntaxt.a
(#22194). -
Custom infix operators can now be defined by appending Unicode combining marks, primes, and sub/superscripts to other operators. For example,
+̂ₐ″
is parsed as an infix operator with the same precedence as+
(#22089). -
The macro call syntax
@macroname[args]
is now available and is parsed as@macroname([args])
(#23519). -
The construct
if @generated ...; else ...; end
can be used to provide both@generated
and normal implementations of part of a function. Surrounding code will be common to both versions (#23168).
-
The syntax for parametric methods,
function f{T}(x::T)
, has been changed tofunction f(x::T) where {T}
(#11310). -
The syntax
1.+2
is deprecated, since it is ambiguous: it could mean either1 .+ 2
(the current meaning) or1. + 2
(#19089). -
In string and character literals, backslash
\
may no longer precede unrecognized escape characters (#22800). -
Juxtaposing binary, octal, and hexadecimal literals is deprecated, since it can lead to confusing code such as
0xapi == 0xa * pi
(#16356). -
Declaring arguments as
x::ANY
to avoid specialization has been replaced by@nospecialize x
. (#22666). -
Keyword argument default values are now evaluated in successive scopes --- the scope for each expression includes only previous keyword arguments, in left-to-right order (#17240).
-
The parsing of
1<<2*3
as1<<(2*3)
is deprecated, and will change to(1<<2)*3
in a future version (#13079). -
The parsing of
<|
is now right associative.|>
remains left associative (#24153). -
{ }
expressions now usebraces
andbracescat
as expression heads instead ofcell1d
andcell2d
, and parse similarly tovect
andvcat
(#8470). -
Nested
if
expressions that arise from the keywordelseif
now useelseif
as their expression head instead ofif
(#21774). -
let
blocks now parse the same asfor
loops; the first argument is either an assignment orblock
of assignments, and the second argument is a block of statements (#21774). -
Parsed and lowered forms of type definitions have been synchronized with their new keywords (#23157). Expression heads are renamed as follows:
-
type
=>struct
-
bitstype
=>primitive
(order of arguments is also reversed, to match syntax) -
composite_type
=>struct_type
-
bits_type
=>primitive_type
-
-
The
global
keyword now only introduces a new binding if one doesn't already exist in the module. This means that assignment to a global (global sin = 3
) may now throw the error: "cannot assign variable Base.sin from module Main", rather than emitting a warning. Additionally, the new bindings are now created before the statement is executed. For example,f() = (global sin = "gluttony"; nothing)
will now resolve which module containssin
eagerly, rather than delaying that decision untilf
is run. (#22984). -
Uninitialized
BitArray
constructors of the formBitArray[{N}](shape...)
have been deprecated in favor of equivalents acceptinguninitialized
(an alias forUninitialized()
) as their first argument, as inBitArray[{N}](uninitialized, shape...)
. For example,BitVector(3)
is nowBitVector(uninitialized, 3)
,BitMatrix((2, 4))
is nowBitMatrix(uninitialized, (2, 4))
, andBitArray{3}(11, 13, 17)
is nowBitArray{3}(uninitialized, 11, 14, 17)
([#24785]). -
Dispatch rules have been simplified: method matching is now determined exclusively by subtyping; the rule that method type parameters must also be captured has been removed. Instead, attempting to access the unconstrained parameters will throw an
UndefVarError
. Linting in package tests is recommended to confirm that the set of methods which might throwUndefVarError
when accessing the static parameters (need_to_handle_undef_sparam = Set{Any}(m.sig for m in Test.detect_unbound_args(Base, recursive=true))
) is equal (==
) to some known set (expected = Set()
). (#23117) -
const
declarations on local variables were previously ignored. They now give a warning, so that this syntax can be disallowed or given a new meaning in a future version (#5148). -
Placing an expression after
catch
, as incatch f(x)
, is deprecated. Usecatch; f(x)
instead (#19987). -
In
for i = ...
, if a local variablei
already existed it would be overwritten during the loop. This behavior is deprecated, and in the futurefor
loop variables will always be new variables local to the loop (#22314). The old behavior of overwriting an existing variable is available viafor outer i = ...
. -
In
for i in x
,x
used to be evaluated in a new scope enclosing thefor
loop. Now it is evaluated in the scope outside thefor
loop. -
Variable bindings local to
while
loop bodies are now freshly allocated on each loop iteration, matching the behavior offor
loops. -
Prefix
&
for by-reference arguments toccall
has been deprecated in favor ofRef
argument types (#6080). -
All line numbers in ASTs are represented by
LineNumberNode
s; the:line
expression head is no longer used.QuoteNode
s are also consistently used for quoted symbols instead of the:quote
expression head (though:quote
Expr
s are still used for quoted expressions) (#23885). -
The
+
and-
methods forNumber
andUniformScaling
are not ambiguous anymore since+
and-
no longer do automatic broadcasting. Hence the methods forUniformScaling
andNumber
are no longer deprecated (#23923). -
The keyword
importall
is deprecated. Useusing
and/or individualimport
statements instead (#22789). -
reduce(+, [...])
andreduce(*, [...])
no longer widen the iterated over arguments to system word size.sum
andprod
still preserve this behavior. (#22825) -
Like
_
, variable names consisting only of underscores can be assigned, but accessing their values is deprecated (#24221). -
Raw string literal escaping rules have been changed to make it possible to write all strings. The rule is that backslashes escape both quotes and other backslashes, but only when a sequence of backslashes precedes a quote character. Thus, 2n backslashes followed by a quote encodes n backslashes and the end of the literal while 2n+1 backslashes followed by a quote encodes n backslashes followed by a quote character ([#22926]).
-
The syntax
(x...)
for constructing a tuple is deprecated; use(x...,)
instead (#24452).
This section lists changes that do not have deprecation warnings.
-
getindex(s::String, r::UnitRange{Int})
now throwsUnicodeError
iflast(r)
is not a valid index intos
(#22572). -
ntuple(f, n::Integer)
throwsArgumentError
ifn
is negative. Previously an empty tuple was returned (#21697). -
Juxtaposing string literals (e.g.
"x"y
) is now a syntax error (#20575). -
finalizer(function, object)
now returnsobject
rather thannothing
([#24679]). -
Macro calls with
for
expressions are now parsed as generators inside function argument lists (#18650). Examples:-
sum(@inbounds a[i] for i = 1:n)
used to give a syntax error, but is now parsed assum(@inbounds(a[i]) for i = 1:n)
. -
sum(@m x for i = 1:n end)
used to parse the argument tosum
as a 2-argument call to macro@m
, but now parses it as a generator plus a syntax error for the danglingend
.
-
-
@__DIR__
returns the current working directory rather thannothing
when not run from a file (#21759). -
@__FILE__
and@__DIR__
return information relative to the file that it was parsed from, rather than from the task-localSOURCE_PATH
global when it was expanded. -
All macros receive an extra argument
__source__::LineNumberNode
which describes the parser location in the source file for the@
of the macro call. It can be accessed as a normal argument variable in the body of the macro. This is implemented by inserting an extra leading argument into theExpr(:macrocall, :@name, LineNumberNode(...), args...)
surface syntax. (#21746) -
Passing the same keyword argument multiple times is now a syntax error (#16937).
-
getsockname
on aTCPSocket
now returns the locally bound address and port of the socket. Previously the address of the remote endpoint was being returned (#21825). -
Using
ARGS
within the ~/.juliarc.jl or within a .jl file loaded with--load
will no longer contain the script name as the first argument. Instead the script name will be assigned toPROGRAM_FILE
. (#22092) -
The format for a
ClusterManager
specifying the cookie on the command line is now--worker=<cookie>
.--worker <cookie>
will not work as it is now an optional argument. -
The representation of
CartesianRange
has changed to a tuple-of-AbstractUnitRanges; thestart
andstop
fields are no longer present. Usefirst(R)
andlast(R)
to obtain start/stop. (#20974) -
The
Diagonal
,Bidiagonal
,Tridiagonal
andSymTridiagonal
type definitions have changed fromDiagonal{T}
,Bidiagonal{T}
,Tridiagonal{T}
andSymTridiagonal{T}
toDiagonal{T,V<:AbstractVector{T}}
,Bidiagonal{T,V<:AbstractVector{T}}
,Tridiagonal{T,V<:AbstractVector{T}}
andSymTridiagonal{T,V<:AbstractVector{T}}
respectively (#22718, #22925, #23035, #23154). -
When called with an argument that contains
NaN
elements,findmin
andfindmax
now return the firstNaN
found and its corresponding index. Previously,NaN
elements were ignored. The new behavior matches that ofmin
,max
,minimum
, andmaximum
. -
isapprox(x,y)
now testsnorm(x-y) <= max(atol, rtol*max(norm(x), norm(y)))
rather thannorm(x-y) <= atol + ...
, andrtol
defaults to zero if anatol > 0
is specified (#22742). -
Spaces are no longer allowed between
@
and the name of a macro in a macro call (#22868). -
Juxtaposition of a non-literal with a macro call (
x@macro
) is no longer valid syntax (#22868). -
On a cluster, all files are now loaded from the local file system rather than node 1 (#22588). To load the same file everywhere from node 1, one possible alternative is to broadcast a call to
include_string
:@everywhere include_string(Main, $(read("filename", String)), "filename")
. Improving upon this API is left as an opportunity for packages. -
randperm(n)
andrandcycle(n)
now always return aVector{Int}
(independent of the type ofn
). Use the corresponding mutating functionsrandperm!
andrandcycle!
to control the array type (#22723). -
Hermitian now ignores any imaginary components in the diagonal instead of checking the diagonal. (#17367)
-
Worker-worker connections are setup lazily for an
:all_to_all
topology. Use keyword arglazy=false
to force all connections to be setup during aaddprocs
call. (#22814) -
In
joinpath(a, b)
on Windows, if the drive specifications ofa
andb
do not match,joinpath
now returnsb
instead of throwing anArgumentError
.joinpath(path...)
is defined to be left associative, so if any argument has a drive path which does not match the drive of the join of the preceding paths, the prior ones are dropped. (#20912) -
^(A::AbstractMatrix{<:Integer}, p::Integer)
now throws aDomainError
ifp < 0
, unlessA == one(A)
orA == -one(A)
(same as for^(A::Integer, p::Integer)
) (#23366). -
^(A::AbstractMatrix{<:Integer}, p::Integer)
now promotes the element type in the same way as^(A::Integer, p::Integer)
. This means, for instance, that[1 1; 0 1]^big(1)
will return aMatrix{BigInt}
instead of aMatrix{Int}
(#23366). -
The element type of the input is now preserved in
unique
. Previously the element type of the output was shrunk to fit the union of the type of each element in the input. (#22696) -
The
promote
function now raises an error if its arguments are of different types and if attempting to convert them to a common type fails to change any of their types. This avoids stack overflows in the common case of definitions likef(x, y) = f(promote(x, y)...)
(#22801). -
findmin
,findmax
,indmin
, andindmax
used to always return linear indices. They now returnCartesianIndex
es for all but 1-d arrays, and in general return thekeys
of indexed collections (e.g. dictionaries) (#22907). -
The
openspecfun
library is no longer built and shipped with Julia, as it is no longer used internally (#22390). -
All loaded packges used to have bindings in
Main
(e.g.Main.Package
). This is no longer the case; now bindings will only exist for packages brought into scope by typingusing Package
orimport Package
(#17997). -
slicedim(b::BitVector, 1, x)
now consistently returns the same thing thatb[x]
would, consistent with its documentation. Previously it would return aBitArray{0}
for scalarx
(#20233). -
The rules for mixed-signedness integer arithmetic (e.g.
Int32(1) + UInt64(1)
) have been simplified: if the arguments have different sizes (in bits), then the type of the larger argument is used. If the arguments have the same size, the unsigned type is used (#9292). -
All command line arguments passed via
-e
,-E
, and-L
will be executed in the order given on the command line (#23665). -
I
now yieldsUniformScaling{Bool}(true)
rather thanUniformScaling{Int64}(1)
to better preserve types in operations involvingI
(#24396). -
The return type of
reinterpret
has changed toReinterpretArray
.reinterpret
on sparse arrays has been discontinued. -
Base.find_in_path
is nowBase.find_package
orBase.find_source_file
(#24320). -
finalizer
now takes functions or pointers as its first argument, and the object being finalized as its second (rather than the reverse). For the majority of use cases deprecation warnings will be triggered. However, deprecation warnings will not trigger where (1) the callable argument is not a subtype ofFunction
; or (2) both arguments areFunction
s orPtr{Void}
s ([#24605]). -
The
kill
function now throws errors on user error (e.g. on permission errors), but returns successfully if the process had previously exited. Its return value has been removed. Use theprocess_running
function to determine if a process has already exited. -
Broadcasting has been redesigned with an extensible public interface. The new API is documented at https://docs.julialang.org/en/latest/manual/interfaces/#Interfaces-1.
AbstractArray
types that specialized broadcasting using the old internal API will need to switch to the new API. (#20740)
-
The function
thisind(s::AbstractString, i::Integer)
returns the largest valid index less or equal thani
in the strings
or0
if no such index exists ([#24414]). -
Irrational
is now a subtype ofAbstractIrrational
(#24245). -
The function
chop
now accepts two argumentshead
andtail
allowing to specify number of characters to remove from the head and tail of the string (#24126). -
Functions
first
andlast
now acceptnchar
argument forAbstractString
. If this argument is used they return a string consisting of first/lastnchar
characters from the original string (#23960). -
Expressions
x^-n
wheren
is an integer literal now correspond toinv(x)^n
. For example,x^-1
is now essentially a synonym forinv(x)
, and works in a type-stable way even iftypeof(x) != typeof(inv(x))
(#24240). -
New
Iterators.reverse(itr)
for reverse-order iteration (#24187). Iterator typesT
can implementstart
etc. forIterators.Reverse{T}
to support this. -
The functions
nextind
andprevind
now acceptnchar
argument that indicates the number of characters to move (#23805). -
The functions
strip
,lstrip
andrstrip
now returnSubString
(#22496). -
The functions
strwidth
andcharwidth
have been merged intotextwidth
(#20816). -
The functions
base
anddigits
digits now accept a negative base (likendigits
did) (#21692). -
The function
randn
now accepts complex arguments (Complex{T <: AbstractFloat}
) (#21973). -
The function
rand
can now pick up random elements from strings, associatives and sets (#22228, #21960, #18155, #22224). -
Method lists are now printed as a numbered list. In addition, the source code of a method can be opened in an editor by entering the corresponding number in the REPL and pressing
^Q
(#22007). -
getpeername
on aTCPSocket
returns the address and port of the remote endpoint of the TCP connection (#21825). -
resize!
andsizehint!
methods no longer over-reserve memory when the requested array size is more than double of its current size (#22038). -
The
crc32c
function for CRC-32c checksums is now exported (#22274). -
eye(::Type{Diagonal{T}}, m::Integer)
has been deprecated in favor ofDiagonal{T}(I, m)
(#24413). -
The output of
versioninfo
is now controlled with keyword arguments (#21974). -
The function
LibGit2.set_remote_url
now always sets both the fetch and push URLs for a git repo. Additionally, the argument order was changed to be consistent with the git command line tool (#22062). -
logspace
now accepts abase
keyword argument to specify the base of the logarithmic range. The base defaults to 10 (#22310). -
Added
unique!
which is an inplace version ofunique
(#20549). -
@test isequal(x, y)
and@test isapprox(x, y)
now prints an evaluated expression when the test fails (#22296). -
Uses of
Val{c}
inBase
has been replaced withVal{c}()
, which is now easily accessible via the@pure
constructorVal(c)
. Functions are defined asf(::Val{c}) = ...
and called byf(Val(c))
. Notable affected functions include:ntuple
,Base.literal_pow
,sqrtm
,lufact
,lufact!
,qrfact
,qrfact!
,cholfact
,cholfact!
,_broadcast!
,reshape
,cat
andcat_t
. -
A new
@macroexpand1
macro for non recursive macro expansion (#21662). -
Char
s can now be concatenated withString
s and/or otherChar
s using*
(#22532). -
Diagonal
,Bidiagonal
,Tridiagonal
andSymTridiagonal
are now parameterized on the type of the wrapped vectors, allowingDiagonal
,Bidiagonal
,Tridiagonal
andSymTridiagonal
matrices with arbitraryAbstractVector
s (#22718, #22925, #23035, #23154). -
Mutating versions of
randperm
andrandcycle
have been added:randperm!
andrandcycle!
(#22723). -
BigFloat
random numbers can now be generated (#22720). -
REPL Undo via Ctrl-/ and Ctrl-_
-
diagm
now accepts several diagonal index/vectorPair
s (#24047). -
New function
equalto(x)
, which returns a function that compares its argument tox
usingisequal
(#23812). -
reinterpret
now works on any AbstractArray using the newReinterpretArray
type. This supersedes the old behavior of reinterpret on Arrays. As a result, reinterpreting arrays with different alignment requirements (removed in 0.6) is once again allowed (#23750).
- The inlining heuristic now models the approximate runtime cost of a method (using some strongly-simplifying assumptions). Functions are inlined unless their estimated runtime cost substantially exceeds the cost of setting up and issuing a subroutine call. (#22210, #22732)
-
The keyword
immutable
is fully deprecated tostruct
, andtype
is fully deprecated tomutable struct
(#19157, #20418). -
Indexing into multidimensional arrays with more than one index but fewer indices than there are dimensions is no longer permitted when those trailing dimensions have lengths greater than 1. Instead, reshape the array or add trailing indices so the dimensionality and number of indices match (#14770, #23628).
-
fill!(A::Diagonal, x)
andfill!(A::AbstractTriangular, x)
have been deprecated in favor ofBase.LinAlg.fillslots!(A, x)
(#24413). -
eye
has been deprecated in favor ofI
andMatrix
constructors. Please see the deprecation warnings for replacement details ([#24438]). -
zeros(D::Diagonal[, opts...])
has been deprecated ([#24654]). -
Using Bool values directly as indices is now deprecated and will be an error in the future. Convert them to
Int
before indexing if you intend to access index1
fortrue
and0
forfalse
. -
whos
has been renamedvarinfo
, and now returns a markdown table instead of printing output ([#12131]). -
Uninitialized
RowVector
constructors of the formRowVector{T}(shape...)
have been deprecated in favor of equivalents acceptinguninitialized
(an alias forUninitialized()
) as their first argument, as inRowVector{T}(uninitialized, shape...)
. For example,RowVector{Int}(3)
is nowRowVector{Int}(uninitialized, 3)
, andRowVector{Float32}((1, 4))
is nowRowVector{Float32}(uninitialized, (1, 4))
([#24786]). -
writecsv(io, a; opts...)
has been deprecated in favor ofwritedlm(io, a, ','; opts...)
(#23529). -
The method
srand(rng, filename, n=4)
has been deprecated (#21359). -
readcsv(io[, T::Type]; opts...)
has been deprecated in favor ofreaddlm(io, ','[, T]; opts...)
(#23530). -
sparse(s::UniformScaling, m::Integer)
has been deprecated in favor of the three-argument equivalentsparse(s::UniformScaling, m, n)
([#24472]). -
The
cholfact
/cholfact!
methods that accepted anuplo
symbol have been deprecated in favor of usingHermitian
(orSymmetric
) views (#22187, #22188). -
The
thin
keyword argument for orthogonal decomposition methods has been deprecated in favor offull
, which has the opposite meaning:thin == true
if and only iffull == false
(#24279). -
isposdef(A::AbstractMatrix, UL::Symbol)
andisposdef!(A::AbstractMatrix, UL::Symbol)
have been deprecated in favor ofisposdef(Hermitian(A, UL))
andisposdef!(Hermitian(A, UL))
respectively (#22245). -
The
bkfact
/bkfact!
methods that accepteduplo
andissymmetric
symbols have been deprecated in favor of usingHermitian
(orSymmetric
) views (#22605). -
The function
current_module
is deprecated and replaced with@__MODULE__
. This caused the deprecation of some reflection methods (such asmacroexpand
andisconst
), which now require a module argument. And it caused the bugfix of other default arguments to use the Main module (includingwhos
,which
) (#22064). -
expand(ex)
andexpand(module, ex)
have been deprecated in favor ofMeta.lower(module, ex)
([#22064, #24278]). -
ones(A::AbstractArray[, opts...])
andzeros(A::AbstractArray[, opts...])
methods have been deprecated. The general replacement isfill!(similar(A[, opts...]), {1|0})
, though in most use cases simpler alternatives are better: Forzeros(A)
, considerzero(A)
. Forones(A)
orzeros(A)
, considerfill(v, size(A))
forv
an appropriate one or zero,fill!(copy(A), {1|0})
,ones(size(A))
orzeros(size(A))
, or any of the preceding with different element type and/or shape depending onopts...
. For an algebraic multiplicative identity, considerone(A)
([#24656]). -
The
Operators
module is deprecated. Instead, import required operators explicitly fromBase
, e.g.import Base: +, -, *, /
(#22251). -
Bindings to the FFTW library have been removed from Base. The DFT framework for building FFT implementations is now in AbstractFFTs.jl, the bindings to the FFTW library are in FFTW.jl, and the Base signal processing functions which used FFTs are now in DSP.jl (#21956).
-
The
corrected
positional argument tocov
has been deprecated in favor of a keyword argument with the same name (#21709). -
Omitting spaces around the
?
and the:
tokens in a ternary expression has been deprecated. Ternaries must now include some amount of whitespace, e.g.x ? a : b
rather thanx?a:b
(#22523 and #22712). -
?
can no longer be used as an identifier name (#22712) -
The method
replace(s::AbstractString, pat, r, count)
withcount <= 0
is deprecated in favor ofreplace(s::AbstractString, pat, r, typemax(Int))
(#22325). -
read(io, type, dims)
is deprecated toread!(io, Array{type}(dims))
(#21450). -
read(::IO, ::Ref)
is now a method ofread!
, since it mutates itsRef
argument (#21592). -
Bidiagonal
constructors now use aSymbol
(:U
or:L
) for the upper/lower argument, instead of aBool
or aChar
(#22703). -
Bidiagonal
,Tridiagonal
andSymTridiagonal
constructors that automatically converted the input vectors to the same type are deprecated in favor of explicit conversion (#22925, #23035, #23154. -
Calling
nfields
on a type to find out how many fields its instances have is deprecated. Usefieldcount
instead. Usenfields
only to get the number of fields in a specific object (#22350). -
fieldnames
now operates only on types. To get the names of fields in an object, usefieldnames(typeof(x))
(#22350). -
InexactError
,DomainError
, andOverflowError
now take arguments.InexactError(func::Symbol, type, -3)
now prints as "ERROR: InexactError: func(type, -3)",DomainError(val, [msg])
prints as "ERROR: DomainError with val:\nmsg", andOverflowError(msg)
prints as "ERROR: OverflowError: msg". (#20005, #22751, #22761) -
The operating system identification functions:
is_linux
,is_bsd
,is_apple
,is_unix
, andis_windows
, have been deprecated in favor ofSys.islinux
,Sys.isbsd
,Sys.isapple
,Sys.isunix
, andSys.iswindows
, respectively (#22182). -
The forms of
read
,readstring
, andeachline
that accepted both aCmd
object and an input stream are deprecated. Use e.g.read(pipeline(stdin, cmd))
instead (#22762). -
The unexported type
AbstractIOBuffer
has been renamed toGenericIOBuffer
(#17360 #22796). -
Remaining vectorized methods over
SparseVector
s, particularlyfloor
,ceil
,trunc
,round
, and most common transcendental functions such asexp
,log
, andsin
variants, have been deprecated in favor of dot-syntax (#22961). -
The method
String(io::IOBuffer)
is deprecated toString(take!(copy(io)))
(#21438). -
The function
readstring
is deprecated in favor ofread(io, String)
(#22793) -
The function
showall
is deprecated. Showing entire values is the default, unless anIOContext
specifying:limit=>true
is in use (#22847). -
issubtype
has been deprecated in favor of<:
(which used to be an alias forissubtype
). -
Calling
write
on non-isbits arrays is deprecated in favor of explicit loops orserialize
(#6466). -
The default
juliarc.jl
file on Windows has been removed. Now must explicitly include the full path if you need access to executables or libraries in theJULIA_HOME
directory, e.g.joinpath(JULIA_HOME, "7z.exe")
for7z.exe
(#21540). -
sqrtm
has been deprecated in favor ofsqrt
(#23504). -
expm
has been deprecated in favor ofexp
(#23233). -
logm
has been deprecated in favor oflog
(#23505). -
full
has been deprecated in favor of more specific, better defined alternatives. On structured matricesA
, consider insteadMatrix(A)
,Array(A)
,SparseMatrixCSC(A)
, orsparse(A)
. On sparse arraysS
, consider insteadVector(S)
,Matrix(S)
, orArray(S)
as appropriate. On factorizationsF
, consider insteadMatrix(F)
,Array(F)
,AbstractMatrix(F)
, orAbstractArray(F)
. On implicit orthogonal factorsQ
, consider insteadMatrix(Q)
orArray(Q)
; for implicit orthogonal factors that can be recovered in square or truncated form, see the deprecation message for square recovery instructions. OnSymmetric
,Hermitian
, orAbstractTriangular
matricesA
, consider insteadMatrix(S)
,Array(S)
,SparseMatrixCSC(S)
, orsparse(S)
. OnSymmetric
matricesA
particularly, consider insteadLinAlg.copytri!(copy(parent(A)), A.uplo)
. OnHermitian
matricesA
particularly, consider insteadLinAlg.copytri!(copy(parent(A)), A.uplo, true)
. OnUpperTriangular
matricesA
particularly, consider insteadtriu!(copy(parent(A)))
. OnLowerTriangular
matricesA
particularly, consider insteadtril!(copy(parent(A)))
(#24250). -
speye
has been deprecated in favor ofI
,sparse
, andSparseMatrixCSC
constructor methods ([#24356]). -
Calling
union
with no arguments is deprecated; construct an empty set with an appropriate element type usingSet{T}()
instead (#23144). -
Vectorized
DateTime
,Date
, andformat
methods have been deprecated in favor of dot-syntax (#23207). -
Base.cpad
has been removed; use an appropriate combination ofrpad
andlpad
instead (#23187). -
ctranspose
andctranspose!
have been deprecated in favor ofadjoint
andadjoint!
, respectively (#23235). -
filter
andfilter!
on dictionaries now pass a singlekey=>value
pair to the argument function, instead of two arguments (#17886). -
rol
,rol!
,ror
, andror!
have been deprecated in favor of specialized methods forcircshift
/circshift!
(#23404). -
Base.SparseArrays.SpDiagIterator
has been removed (#23261). -
The tuple-of-types form of
cfunction
,cfunction(f, returntype, (types...))
, has been deprecated in favor of the tuple-type formcfunction(f, returntype, Tuple{types...})
(#23066). -
diagm(v::AbstractVector, k::Integer=0)
has been deprecated in favor ofdiagm(k => v)
(#24047). -
diagm(x::Number)
has been deprecated in favor offill(x, 1, 1)
(#24047). -
diagm(A::SparseMatrixCSC)
has been deprecated in favor ofspdiagm(sparsevec(A))
(#23341). -
diagm(A::BitMatrix)
has been deprecated, usediagm(0 => vec(A))
orBitMatrix(Diagonal(vec(A)))
instead (#23373, #24047). -
ℯ
(written as\mscre<TAB>
or\euler<TAB>
) is now the only (by default) exported name for Euler's number, and the type has changed fromIrrational{:e}
toIrrational{:ℯ}
(#23427). -
The mathematical constants
π
,pi
,ℯ
,e
,γ
,eulergamma
,catalan
,φ
andgolden
have been moved fromBase
to a new module;Base.MathConstants
. Onlyπ
,pi
andℯ
are now exported by default fromBase
(#23427). -
eu
(previously an alias forℯ
) has been deprecated in favor ofℯ
(orMathConstants.e
) (#23427). -
GMP.gmp_version()
,GMP.GMP_VERSION
,GMP.gmp_bits_per_limb()
, andGMP.GMP_BITS_PER_LIBM
have been renamed toGMP.version()
,GMP.VERSION
,GMP.bits_per_libm()
, andGMP.BITS_PER_LIBM
, respectively. Similarly,MPFR.get_version()
, has been renamed toMPFR.version()
(#23323). Also,LinAlg.LAPACK.laver()
has been renamed toLinAlg.LAPACK.version()
and now returns aVersionNumber
. -
select
,select!
,selectperm
andselectperm!
have been renamed respectively topartialsort
,partialsort!
,partialsortperm
andpartialsortperm!
(#23051). -
The
Range
abstract type has been renamed toAbstractRange
(#23570). -
map
on dictionaries previously operated onkey=>value
pairs. This behavior is deprecated, and in the futuremap
will operate only on values (#5794). -
Automatically broadcasted
+
and-
forarray + scalar
,scalar - array
, and so-on have been deprecated due to inconsistency with linear algebra. Use.+
and.-
for these operations instead ([#22880], [#22932]). -
isleaftype
is deprecated in favor of a simpler predicateisconcrete
. Concrete types are those that might equaltypeof(x)
for somex
;isleaftype
includes some types for which this is not true. If you are certain you need the old behavior, it is temporarily available asBase._isleaftype
(#17086). -
contains(eq, itr, item)
is deprecated in favor ofany
with a predicate (#23716). -
spdiagm(x::AbstractVector)
has been deprecated in favor ofsparse(Diagonal(x))
alternativelyspdiagm(0 => x)
(#23757). -
spdiagm(x::AbstractVector, d::Integer)
andspdiagm(x::Tuple{<:AbstractVector}, d::Tuple{<:Integer})
have been deprecated in favor ofspdiagm(d => x)
andspdiagm(d[1] => x[1], d[2] => x[2], ...)
respectively. The newspdiagm
implementation now always returns a square matrix (#23757). -
Constructors for
LibGit2.UserPasswordCredentials
andLibGit2.SSHCredentials
which take aprompt_if_incorrect
argument are deprecated. Instead, prompting behavior is controlled using theallow_prompt
keyword in theLibGit2.CredentialPayload
constructor (#23690). -
gradient
is deprecated and will be removed in the next release (#23816). -
The timing functions
tic
,toc
, andtoq
are deprecated in favor of@time
and@elapsed
(#17046). -
Methods of
findfirst
,findnext
,findlast
, andfindprev
that accept a value to search for are deprecated in favor of passing a predicate (#19186, #10593). -
find
functions now operate only on booleans by default. To look for non-zeros, usex->x!=0
or!iszero
(#23120). -
The ability of
reinterpret
to yieldArray
s of different type than the underlying storage has been removed. Thereinterpret
function is still available, but now returns aReinterpretArray
. The three argument form ofreinterpret
that implicitly reshapes has been deprecated (#23750). -
bits
has been deprecated in favor ofbitstring
(#24281, #24263). -
num2hex
andhex2num
have been deprecated in favor ofreinterpret
combined withparse
/hex
(#22088). -
a:b
is deprecated for constructing aStepRange
whena
andb
have physical units (Dates and Times). Usea:s:b
, wheres = Dates.Day(1)
ors = Dates.Second(1)
. -
cumsum
,cumprod
,accumulate
, and their mutating versions now require adim
argument instead of defaulting to using the first dimension ([#24684]).
-
New option
--warn-overwrite={yes|no}
to control the warning for overwriting method definitions. The default isno
(#23002). -
New option
--banner={yes,no}
allows suppressing or forcing the printing of the startup banner, overriding the default behavior (banner in REPL, no banner otherwise). The--quiet
option implies--banner=no
even in REPL mode but can be overridden by passing--quiet
together with--banner=yes
(#23342). -
The option
--precompiled
has been renamed to--sysimage-native-code
(#23054). -
The option
--compilecache
has been renamed to--compiled-modules
(#23054).
-
New type system capabilities (#8974, #18457)
-
Type parameter constraints can refer to previous parameters, e.g.
type Foo{R<:Real, A<:AbstractArray{R}}
. Can also be used in method definitions. -
New syntax
Array{T} where T<:Integer
, indicating a union of types over all specified values ofT
(represented by aUnionAll
type). This provides behavior similar to parametric methods ortypealias
, but can be used anywhere a type is accepted. This syntax can also be used in method definitions, e.g.function inv(M::Matrix{T}) where T<:AbstractFloat
. Anonymous functions can have type parameters via the syntax((x::Array{T}) where T<:Real) -> 2x
. -
Implicit type parameters, e.g.
Vector{<:Real}
is equivalent toVector{T} where T<:Real
, and similarly forVector{>:Int}
(#20414). -
Much more accurate subtype and type intersection algorithms. Method sorting and identification of equivalent and ambiguous methods are improved as a result.
-
-
"Inner constructor" syntax for parametric types is deprecated. For example, in this definition:
type Foo{T,S<:Real} x Foo(x) = new(x) end
the syntax
Foo(x) = new(x)
actually defined a constructor forFoo{T,S}
, i.e. the case where the type parameters are specified. For clarity, this definition now must be written asFoo{T,S}(x) where {T,S<:Real} = new(x)
(#11310, #20308). -
The keywords used to define types have changed (#19157, #20418).
-
immutable
changes tostruct
-
type
changes tomutable struct
-
abstract
changes toabstract type ... end
-
bitstype 32 Char
changes toprimitive type Char 32 end
In 0.6,
immutable
andtype
are still allowed as synonyms without a deprecation warning. -
-
Multi-line and single-line nonstandard command literals have been added. A nonstandard command literal is like a nonstandard string literal, but the syntax uses backquotes (
`
) instead of double quotes, and the resulting macro called is suffixed with_cmd
. For instance, the syntaxq`xyz`
is equivalent to@q_cmd "xyz"
(#18644). -
Nonstandard string and command literals can now be qualified with their module. For instance,
Base.r"x"
is now parsed asBase.@r_str "x"
. Previously, this syntax parsed as an implicit multiplication (#18690). -
For every binary operator
⨳
,a .⨳ b
is now automatically equivalent to thebroadcast
call(⨳).(a, b)
. Hence, one no longer defines methods for.*
etcetera. This also means that "dot operations" automatically fuse into a single loop, along with other dot callsf.(x)
(#17623). Similarly for unary operators (#20249). -
Newly defined methods are no longer callable from the same dynamic runtime scope they were defined in (#17057).
-
isa
is now parsed as an infix operator with the same precedence asin
(#19677). -
@.
is now parsed as@__dot__
, and can be used to add dots to every function call, operator, and assignment in an expression (#20321). -
The identifier
_
can be assigned, but accessing its value is deprecated, allowing this syntax to be used in the future for discarding values (#9343, #18251, #20328). -
The
typealias
keyword is deprecated, and should be replaced withVector{T} = Array{T,1}
or aconst
assignment (#20500). -
Experimental feature:
x^n
for integer literalsn
(e.g.x^3
orx^-3
) is now lowered toBase.literal_pow(^, x, Val{n})
, to enable compile-time specialization for literal integer exponents (#20530, #20889).
This section lists changes that do not have deprecation warnings.
-
The constructor of
SubString
now checks if the requsted view range is defined by valid indices in the parentAbstractString
(#22511). -
readline
,readlines
andeachline
return lines without line endings by default. You must usereadline(s, chomp=false)
, etc. to get the old behavior where returned lines include trailing end-of-line character(s) (#19944). -
String
s no longer have a.data
field (as part of a significant performance improvement). UseVector{UInt8}(str)
to access a string as a byte array. However, allocating theVector
object has overhead. You can also usecodeunit(str, i)
to access thei
th byte of aString
. Usesizeof(str)
instead oflength(str.data)
, andpointer(str)
instead ofpointer(str.data)
(#19449). -
Operations between
Float16
andIntegers
now returnFloat16
instead ofFloat32
(#17261). -
Keyword arguments are processed left-to-right: if the same keyword is specified more than once, the rightmost occurrence takes precedence (#17785).
-
The
lgamma(z)
function now uses a different (more standard) branch cut forreal(z) < 0
, which differs fromlog(gamma(z))
by multiples of 2π in the imaginary part (#18330). -
broadcast
now handles tuples, and treats any argument that is not a tuple or an array as a "scalar" (#16986). -
broadcast
now produces aBitArray
instead ofArray{Bool}
for functions yielding a boolean result. If you wantArray{Bool}
, usebroadcast!
or.=
(#17623). -
Broadcast
A[I...] .= X
with entirely scalar indicesI
is deprecated as its behavior will change in the future. UseA[I...] = X
instead. -
Operations like
.+
and.*
onRange
objects are now genericbroadcast
calls (see above) and produce anArray
. If you want aRange
result, use+
and*
, etcetera (#17623). -
broadcast
now treatsRef
(except forPtr
) arguments as 0-dimensional arrays (#18965). -
broadcast
now handles missing data (Nullable
s) allowing operations to be lifted over mixtures ofNullable
s and scalars, as if theNullable
were like an array with zero or one element (#16961, #19787). -
The runtime now enforces when new method definitions can take effect (#17057). The flip-side of this is that new method definitions should now reliably actually take effect, and be called when evaluating new code (#265).
-
The array-scalar methods of
/
,\
,*
,+
, and-
now follow broadcast promotion rules. (Likewise for the now-deprecated array-scalar methods ofdiv
,mod
,rem
,&
,|
, andxor
; see "Deprecated or removed" below.) (#19692). -
broadcast!(f, A)
now callsf()
for each element ofA
, rather than doingfill!(A, f())
(#19722). -
rmprocs
now throws an exception if requested workers have not been completely removed beforewaitfor
seconds. With awaitfor=0
,rmprocs
returns immediately without waiting for worker exits. -
quadgk
has been moved from Base into a separate package (#19741). -
The
Collections
module has been removed, and all functions defined therein have been moved to theDataStructures
package (#19800). -
The
RepString
type has been moved to the LegacyStrings.jl package. -
In macro calls with parentheses, e.g.
@m(a=1)
, assignments are now parsed as=
expressions, instead of askw
expressions (#7669). -
When used as an infix operator,
~
is now parsed as a call to an ordinary operator with assignment precedence, instead of as a macro call (#20406). -
(µ "micro" and ɛ "latin epsilon") are considered equivalent to the corresponding Greek characters in identifiers.
\varepsilon
now tab-completes to U+03B5 (greek small letter epsilon) (#19464). -
retry
now inputs the keyword argumentsdelays
andcheck
instead ofn
andmax_delay
. The previous functionality can be achieved settingdelays
toExponentialBackOff
(#19331). -
transpose(::AbstractVector)
now always returns aRowVector
view of the input (which is a special 1×n-sizedAbstractMatrix
), not aMatrix
, etc. In particular, forv::AbstractVector
we now have(v.').' === v
andv.' * v
is a scalar (#19670). -
Parametric types with "unspecified" parameters, such as
Array
, are now represented asUnionAll
types instead ofDataType
s (#18457). -
Union
types have two fields,a
andb
, instead of a singletypes
field. The empty typeUnion{}
is represented by a singleton of typeTypeofBottom
(#18457). -
The type
NTuple{N}
now refers to tuples where every element has the same type (since it is shorthand forNTuple{N,T} where T
). To get the old behavior of matching any tuple, useNTuple{N,Any}
(#18457). -
FloatRange
has been replaced byStepRangeLen
, and the internal representation ofLinSpace
has changed. Aside from changes in the internal field names, this leads to several differences in behavior (#18777):-
Both
StepRangeLen
andLinSpace
can represent ranges of arbitrary object types---they are no longer limited to floating-point numbers. -
For ranges that produce
Float64
,Float32
, orFloat16
numbers,StepRangeLen
can be used to produce values with little or no roundoff error due to internal arithmetic that is typically twice the precision of the output result. -
To take advantage of this precision,
linspace(start, stop, len)
now returns a range of typeStepRangeLen
rather thanLinSpace
whenstart
andstop
areFloatNN
.LinSpace(start, stop, len)
always returns aLinSpace
. -
StepRangeLen(a, step, len)
constructs an ordinary-precision range using the values and types ofa
andstep
as given, whereasrange(a, step, len)
will attempt to match inputsa::FloatNN
andstep::FloatNN
to rationals and construct aStepRangeLen
that internally uses twice-precision arithmetic. These two outcomes exhibit differences in both precision and speed.
-
-
A=>B
expressions are now parsed as calls instead of using=>
as the expression head (#20327). -
The
count
function no longer sums non-boolean values (#20404) -
The generic
getindex(::AbstractString, ::AbstractVector)
method's signature has been tightened togetindex(::AbstractString, ::AbstractVector{<:Integer})
. Consequently, indexing intoAbstractString
s with non-AbstractVector{<:Integer}
AbstractVector
s now throws aMethodError
in the absence of an appropriate specialization. (Previously such cases failed less explicitly with the exception ofAbstractVector{Bool}
, which now throws anArgumentError
noting that logical indexing into strings is not supported.) (#20248) -
Bessel, Hankel, Airy, error, Dawson, eta, zeta, digamma, inverse digamma, trigamma, and polygamma special functions have been moved from Base to the SpecialFunctions.jl package (#20427). Note that
airy
,airyx
andairyprime
have been deprecated in favor of more specific functions (airyai
,airybi
,airyaiprime
,airybiprimex
,airyaix
,airybix
,airyaiprimex
,airybiprimex
) (#18050). -
When a macro is called in the module in which that macro is defined, global variables in the macro are now correctly resolved in the macro definition environment. Breakage from this change commonly manifests as undefined variable errors that do not occur under 0.5. Fixing such breakage typically requires sprinkling additional
esc
s in the offending macro (#15850). -
write
on anIOBuffer
now returns a signed integer in order to be consistent with other buffers (#20609). -
The
<:Integer
division fallback/(::Integer, ::Integer)
, which formerly inappropriately took precedence over other division methods for some mixed-integer-type division calls, has been removed (#19779). -
@async
,@spawn
,@spawnat
,@fetch
and@fetchfrom
no longer implicitly localize variables. Previously, the expression would be wrapped in an implicitlet
block (#19594). -
parse
no longer accepts IPv4 addresses including leading zeros, octal, or hexadecimal. Convert IPv4 addresses including octal or hexadecimal to decimal, and remove leading zeros in decimal addresses (#19811). -
Closures shipped for remote execution via
@spawn
orremotecall
now automatically serialize globals defined under Main. For details, please refer to the paragraph on "Global variables" under the "Parallel computing" chapter in the manual (#19594). -
homedir
now determines the user's home directory vialibuv
'suv_os_homedir
, rather than from environment variables (#19636). -
Workers now listen on an ephemeral port assigned by the OS. Previously workers would listen on the first free port available from 9009 (#21818).
-
A new
@views
macro was added to convert a whole expression or block of code to use views for all slices (#20164). -
max
,min
, and related functions (minmax
,maximum
,minimum
,extrema
) now returnNaN
forNaN
arguments (#12563). -
oneunit(x)
function to return a dimensionful version ofone(x)
(which is clarified to mean a dimensionless quantity ifx
is dimensionful) (#20268). -
The
chop
andchomp
functions now return aSubString
(#18339). -
Numbered stackframes printed in stacktraces can now be opened in an editor by entering the corresponding number in the REPL and pressing
^Q
(#19680). -
The REPL now supports something called prompt pasting (#17599). This activates when pasting text that starts with
julia>
into the REPL. In that case, only expressions starting withjulia>
are parsed, the rest are removed. This makes it possible to paste a chunk of code that has been copied from a REPL session without having to scrub away prompts and outputs. This can be disabled or enabled at will withBase.REPL.enable_promptpaste(::Bool)
. -
The function
print_with_color
can now take a color represented by an integer between 0 and 255 inclusive as its first argument (#18473). For a number-to-color mapping, please refer to this chart. It is also possible to use numbers as colors in environment variables that customizes colors in the REPL. For example, to get orange warning messages, simply setENV["JULIA_WARN_COLOR"] = 208
. Please note that not all terminals support 256 colors. -
The function
print_with_color
no longer prints text in bold by default (#18628). Instead, the function now take a keyword argumentbold::Bool
which determines whether to print in bold or not. On some terminals, printing a color in non bold results in slightly darker colors being printed than when printing in bold. Therefore, light versions of the colors are now supported. For the available colors see the help entry onprint_with_color
. -
The default text style for REPL input and answers has been changed from bold to normal (#11250). They can be changed back to bold by setting the environment variables
JULIA_INPUT_COLOR
andJULIA_ANSWER_COLOR
to"bold"
. For example, one way of doing this is addingENV["JULIA_INPUT_COLOR"] = :bold
andENV["JULIA_ANSWER_COLOR"] = :bold
to the.juliarc.jl
file. See the manual section on customizing colors for more information. -
The default color for info messages has been changed from blue to cyan (#18442), and for warning messages from red to yellow (#18453). This can be changed back to the original colors by setting the environment variables
JULIA_INFO_COLOR
to"blue"
andJULIA_WARN_COLOR
to"red"
. -
Iteration utilities that wrap iterators and return other iterators (
enumerate
,zip
,rest
,countfrom
,take
,drop
,cycle
,repeated
,product
,flatten
,partition
) have been moved to the moduleBase.Iterators
(#18839). -
BitArrays can now be constructed from arbitrary iterables, in particular from generator expressions, e.g.
BitArray(isodd(x) for x = 1:100)
(#19018). -
hcat
,vcat
, andhvcat
now work withUniformScaling
objects, so you can now do e.g.[A I]
and it will concatenate an appropriately sized identity matrix (#19305). -
New
accumulate
andaccumulate!
functions were added, which generalizecumsum
andcumprod
. Also known as a scan operation (#18931). -
reshape
now allows specifying one dimension with aColon()
(:
) for the new shape, in which case that dimension's length will be computed such that its product with all the other dimensions is equal to the length of the original array (#19919). -
The new
to_indices
function provides a uniform interface for index conversions, taking an array and a tuple of indices as arguments and returning a tuple of integers and/or arrays of supported scalar indices. It will throw anArgumentError
for any unsupported indices, and the returned arrays should be iterated over (and not indexed into) to support more efficient logical indexing (#19730).-
Using colons (
:
) to represent a collection of indices is deprecated. They now must be explicitly converted to a specialized array of integers with theto_indices
function. As a result, the type ofSubArray
s that represent views over colon indices has changed. -
Logical indexing is now more efficient. Logical arrays are converted by
to_indices
to a lazy, iterable collection of indices that doesn't support indexing. A deprecation provides indexing support with O(n) lookup. -
The performance of indexing with
CartesianIndex
es is also improved in many situations.
-
-
A new
titlecase
function was added, to capitalize the first character of each word within a string (#19469). -
any
andall
now always short-circuit, andmapreduce
never short-circuits (#19543). That is, not every member of the input iterable will be visited if atrue
(in the case ofany
) orfalse
(in the case ofall
) value is found, andmapreduce
will visit all members of the iterable. -
Additional methods for
ones
andzeros
functions were added to support the same signature as thesimilar
function (#19635). -
count
now has acount(itr)
method equivalent tocount(identity, itr)
(#20403). -
Methods for
map
andfilter
withNullable
arguments have been implemented; the semantics are as if theNullable
were a container with zero or one elements (#16961). -
New
@test_warn
and@test_nowarn
macros were added in theBase.Test
module to test for the presence or absence of warning messages (#19903). -
logging
can now be used to redirectinfo
,warn
, anderror
messages either universally or on a per-module/function basis (#16213). -
New function
Base.invokelatest(f, args...)
to call the latest version of a function in circumstances where an older version may be called instead (e.g. in a function callingeval
) (#19784). -
A new
iszero(x)
function was added, to quickly check whetherx
is zero (or is all zeros, for an array) (#19950). -
notify
now returns a count of tasks woken up (#19841). -
A new nonstandard string literal
raw"..."
was added, for creating strings with no interpolation or unescaping (#19900). -
A new
Dates.Time
type was added that supports representing the time of day with up to nanosecond resolution (#12274). -
Raising one or negative one to a negative integer power formerly threw a
DomainError
. One raised to any negative integer power now yields one, negative one raised to any negative even integer power now yields one, and negative one raised to any negative odd integer power now yields negative one. Similarly, raisingtrue
to any negative integer power now yieldstrue
rather than throwing aDomainError
(#18342). -
A new
@macroexpand
macro was added as a convenient alternative to themacroexpand
function (#18660). -
invoke
now supports keyword arguments (#20345). -
A new
ConjArray
type was added, as a wrapper type for lazy complex conjugation of arrays. Currently, it is used by default for the newRowVector
type only, and enforces that bothtranspose(vec)
andctranspose(vec)
are views not copies (#20047). -
rem
now accepts aRoundingMode
argument viarem(x, y, r::RoundingMode)
, yieldingx - y*round(x/y, r)
without intermediate rounding. In particular,rem(x, y, RoundNearest)
yields a value in the interval[-abs(y)/2, abs(y)/2]
), which corresponds to the IEE754remainder
function. Similarly,rem2pi(x, r::RoundingMode)
now exists as well, yieldingrem(x, 2pi, r::RoundingMode)
but with greater accuracy (#10946). -
map[!]
andbroadcast[!]
now have dedicated methods for sparse/structured vectors/matrices. Specifically,map[!]
andbroadcast[!]
over combinations including one or moreSparseVector
,SparseMatrixCSC
,Diagonal
,Bidiagonal
,Tridiagonal
, orSymTridiagonal
, and any number ofbroadcast
scalars,Vector
s, orMatrix
s, now efficiently yieldSparseVector
s orSparseMatrix
s as appropriate (#19239, #19371, #19518, #19438, #19690, #19724, #19926, #19934, #20009). -
The operators
!
and∘
(\circ<tab>
at the REPL and in most code editors) now respectively perform predicate function negation and function composition. For example,map(!iszero, (0, 1))
is now equivalent tomap(x -> !iszero(x), (0, 1))
andmap(uppercase ∘ hex, 250:255)
is now equivalent tomap(x -> uppercase(hex(x)), 250:255)
(#17155). -
enumerate
now supports the two-argument formenumerate(::IndexStyle, iterable)
. This form allows specification of the returned indices' style. For example,enumerate(IndexLinear, iterable)
yields linear indices andenumerate(IndexCartesian, iterable)
yields cartesian indices (#16378). -
Jump to first/last history entries in the REPL via "Alt-<" and "Alt->" (#22829).
-
ccall
is now implemented as a macro, removing the need for special code-generator support forIntrinsics
(#18754). -
ccall
gained limited support for allvmcall
calling-convention. This can replace many uses ofllvmcall
with a simpler, shorter declaration (#18754). -
All
Intrinsics
are nowBuiltin
functions instead and have proper error checking and fall-back static compilation support (#18754).
-
ipermutedims(A::AbstractArray, p)
has been deprecated in favor ofpermutedims(A, invperm(p))
(#18891). -
Linear indexing is now only supported when there is exactly one non-cartesian index provided. Allowing a trailing index at dimension
d
to linearly access the higher dimensions from arrayA
(beyondsize(A, d)
) has been deprecated as a stricter constraint during bounds checking. Instead,reshape
the array such that its dimensionality matches the number of indices (#20079). -
Multimedia.@textmime "mime"
has been deprecated. Instead defineMultimedia.istextmime(::MIME"mime") = true
(#18441). -
isdefined(a::Array, i::Int)
has been deprecated in favor ofisassigned
(#18346). -
The three-argument
SubArray
constructor (which acceptsdims::Tuple
as its third argument) has been deprecated in favor of the two-argument equivalent (thedims::Tuple
argument being superfluous) (#19259). -
is
has been deprecated in favor of===
(which used to be an alias foris
) (#17758). -
Ambiguous methods for addition and subtraction between
UniformScaling
s andNumber
s, for example(+)(J::UniformScaling, x::Number)
, have been deprecated in favor of unambiguous, explicit equivalents, for exampleJ.λ + x
(#17607). -
num
andden
have been deprecated in favor ofnumerator
anddenominator
respectively (#19233,#19246). -
delete!(ENV::EnvDict, k::AbstractString, def)
has been deprecated in favor ofpop!(ENV, k, def)
. Be aware thatpop!
returnsk
ordef
, whereasdelete!
returnsENV
ordef
(#18012). -
infix operator
$
has been deprecated in favor of infix⊻
or functionxor
(#18977). -
The single-argument form of
write
(write(x)
, with implicitSTDOUT
output stream), has been deprecated in favor of the explicit equivalentwrite(STDOUT, x)
(#17654). -
Dates.recur
has been deprecated in favor offilter
(#19288) -
A number of ambiguous
convert
operations betweenNumber
s (especiallyReal
s) andDate
,DateTime
, andPeriod
types have been deprecated in favor of unambiguousconvert
and explicit constructor calls. Additionally, ambiguous colon construction of<:Period
ranges without step specification, for exampleDates.Hour(1):Dates.Hour(2)
, has been deprecated in favor of such construction including step specification, for exampleDates.Hour(1):Dates.Hour(1):Dates.Hour(2)
(#19920). -
cummin
andcummax
have been deprecated in favor ofaccumulate
(#18931). -
The
Array
constructor syntaxArray(T, dims...)
has been deprecated in favor of the formsArray{T,N}(dims...)
(whereN
is known, or particularlyVector{T}(dims...)
forN = 1
andMatrix{T}(dims...)
forN = 2
), andArray{T}(dims...)
(whereN
is not known). Likewise forSharedArray
s (#19989). -
sumabs
andsumabs2
have been deprecated in favor ofsum(abs, x)
andsum(abs2, x)
, respectively.maxabs
andminabs
have similarly been deprecated in favor ofmaximum(abs, x)
andminimum(abs, x)
. Likewise for the in-place counterparts of these functions (#19598). -
The array-reducing form of
isinteger
(isinteger(x::AbstractArray)
) has been deprecated in favor ofall(isinteger, x)
(#19925). -
produce
,consume
and iteration over a Task object have been deprecated in favor of using Channels for inter-task communication (#19841). -
The
negate
keyword has been deprecated from all functions in theDates
adjuster API (adjust
,tonext
,toprev
,Date
,Time
, andDateTime
). Instead use predicate function negation via the!
operator (see Library Improvements) (#20213). -
@test_approx_eq x y
has been deprecated in favor of@test isapprox(x,y)
or@test x ≈ y
(#4615). -
Matrix()
andMatrix{T}()
have been deprecated in favor of the explicit formsMatrix(0, 0)
andMatrix{T}(0, 0)
(#20330). -
Vectorized functions have been deprecated in favor of dot syntax (#17302, #17265, #18558, #19711, #19712, #19791, #19802, #19931, #20543, #20228).
-
All methods of character predicates (
isalnum
,isalpha
,iscntrl
,isdigit
,isnumber
,isgraph
,islower
,isprint
,ispunct
,isspace
,isupper
,isxdigit
) that acceptAbstractStrings
have been deprecated in favor ofall
. For example,isnumber("123")
should now be expressedall(isnumber, "123")
(#20342). -
A few names related to indexing traits have been changed:
LinearIndexing
andlinearindexing
have been deprecated in favor ofIndexStyle
.LinearFast
has been deprecated in favor ofIndexLinear
, andLinearSlow
has been deprecated in favor ofIndexCartesian
(#16378). -
The two-argument forms of
map
(map!(f, A)
) andasyncmap!
(asyncmap!(f, A)
) have been deprecated in anticipation of future semantic changes (#19721). -
unsafe_wrap(String, ...)
has been deprecated in favor ofunsafe_string
(#19449). -
zeros
andones
methods accepting an element type as the first argument and an array as the second argument, for examplezeros(Float64, [1, 2, 3])
, have been deprecated in favor of equivalent methods with the second argument instead the size of the array, for examplezeros(Float64, size([1, 2, 3]))
(#21183). -
Base.promote_eltype_op
has been deprecated (#19669, #19814, #19937). -
isimag
has been deprecated (#19949). -
The tuple-of-types form of
invoke
,invoke(f, (types...), ...)
, has been deprecated in favor of the tuple-type forminvoke(f, Tuple{types...}, ...)
(#18444). -
Base._promote_array_type
has been deprecated (#19766). -
Methods allowing indexing of tuples by
AbstractArray
s with more than one dimension have been deprecated. (Indexing a tuple by such a higher-dimensionalAbstractArray
should yield a tuple with more than one dimension, but tuples are one-dimensional.) (#19737). -
@test_approx_eq a b
has been deprecated in favor of@test a ≈ b
(or, equivalently,@test ≈(a, b)
or@test isapprox(a, b)
).@test_approx_eq_eps
has been deprecated in favor of new@test
syntax:@test
now supports the syntax@test f(args...) key=val ...
for@test f(args..., key=val...)
. This syntax allows, for example, writing@test a ≈ b atol=c
in place of@test ≈(a, b, atol=c)
(and hence@test_approx_eq_eps a b c
) (#19901). -
takebuf_array
has been deprecated in favor oftake!
, andtakebuf_string(x)
has been deprecated in favor ofString(take!(x))
(#19088). -
convert
methods fromDiagonal
andBidiagonal
to subtypes ofAbstractTriangular
have been deprecated (#17723). -
Base.LinAlg.arithtype
has been deprecated. If you were usingarithtype
within apromote_op
call, instead usepromote_op(Base.LinAlg.matprod, Ts...)
. Otherwise, consider defining equivalent functionality locally (#18218). -
Special characters (
#{}()[]<>|&*?~;
) should now be quoted in commands. For example,`export FOO=1\;`
should replace`export FOO=1;`
and`cd $dir '&&' $thingie`
should replace`cd $dir && $thingie`
(#19786). -
Zero-argument
Channel
constructors (Channel()
,Channel{T}()
) have been deprecated in favor of equivalents accepting an explicitChannel
size (Channel(2)
,Channel{T}(2)
) (#18832). -
The zero-argument constructor
MersenneTwister()
has been deprecated in favor of the explicitMersenneTwister(0)
(#16984). -
Base.promote_type(op::Type, Ts::Type...)
has been removed as part of an overhaul ofbroadcast
's promotion mechanism. If you need the functionality of thatBase.promote_type
method, consider defining it locally viaCore.Inference.return_type(op, Tuple{Ts...})
(#18642). -
bitbroadcast
has been deprecated in favor ofbroadcast
, which now produces aBitArray
instead ofArray{Bool}
for functions yielding a boolean result (#19771). -
To complete the deprecation of histogram-related functions,
midpoints
has been deprecated. Instead use the StatsBase.jl package'smidpoints
function (#20058). -
Passing a type argument to
LibGit2.cat
has been deprecated in favor of a simpler, two-argument method forLibGit2.cat
(#20435). -
The
LibGit2.owner
function for finding the repository which owns a given Git object has been deprecated in favor ofLibGit2.repository
(#20135). -
The
LibGit2.GitAnyObject
type has been renamed toLibGit2.GitUnknownObject
to clarify its intent (#19935). -
The
LibGit2.GitOid
type has been renamed toLibGit2.GitHash
for clarity (#19878). -
Finalizing
LibGit2
objects withfinalize
has been deprecated in favor of usingclose
(#19660). -
Parsing string dates from a
Dates.DateFormat
object has been deprecated as part of a larger effort toward faster, more extensible date parsing (#20952). -
EnvHash
has been renamed toEnvDict
(#24167). -
linspace
andlogspace
now require an explicit number of elements to be supplied rather than defaulting to50
.
- In
polly
builds (USE_POLLY := 1
), the new flag--polly={yes|no}
controls whether@polly
declarations are respected. (With--polly=no
,@polly
declarations are ignored.) This flag is also available in non-polly
builds (USE_POLLY := 0
), but has no effect (#18159).