Julia v0.7.0 Release Notes
New language features
Local variables can be tested for being defined using the new
@isdefined variablemacro (#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 variablesxandyas 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).Keyword argument containers (
kwinf(; kw...)) are now based on named tuples. Dictionary functions likehaskeyand indexing can be used on them, and name-value pairs can be iterated usingpairs(kw).kwcan no longer contain multiple entries for the same argument name (#4916).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 ...; endcan be used to provide both@generatedand normal implementations of part of a function. Surrounding code will be common to both versions (#23168).Added
⟂(\perp) operator with comparison precedence (#24404).The
missingsingleton object (of typeMissing) has been added to represent missing values (#24653). It propagates through standard operators and mathematical functions, and implements three-valued logic, similar to SQLsNULLand R'sNA.Field access via dot-syntax can now be overloaded by adding methods to
Base.getpropertyandBase.setproperty!(#1974), optionally along with a correspondingBase.propertynamesmethod for reflection (#25311).Values for
Enums can now be specified inside of abeginblock when using the@enummacro (#25424).Keyword arguments can be required: if a default value is omitted, then an exception is thrown if the caller does not assign the keyword a value (#25830).
The pair operator
=>is now broadcastable as.=>which was previously a parsing error (#27447)
Language changes
The syntax for parametric methods,
function f{T}(x::T), has been changed tofunction f(x::T) where {T}(#11310).The fallback constructor that calls
convertis deprecated. Instead, new types should prefer to define constructors, and addconvertmethods that call those constructors only as necessary (#15120).The syntax
1.+2is deprecated, since it is ambiguous: it could mean either1 .+ 2(the current meaning) or1. + 2(#19089).Mutable structs with no fields are no longer singletons; it is now possible to make multiple instances of them that can be distinguished by
===(#25854). Zero-size immutable structs are still singletons.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).Numeric literal juxtaposition now has slighty lower precedence than unary operators, so for example
√2xparses as(√2) * x(#27641).Declaring arguments as
x::ANYto avoid specialization has been replaced by@nospecialize x. (#22666).This can also be used in global scope, to apply to all subsequent method definitions in the module (until
@specialize). (#28065)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*3as1<<(2*3)is deprecated, and will change to(1<<2)*3in a future version (#13079).The parsing of
<|is now right associative.|>remains left associative (#24153).:now parses like other operators, as a call to a function named:, instead of callingcolon(#25947).{ }expressions now usebracesandbracescatas expression heads instead ofcell1dandcell2d, and parse similarly tovectandvcat(#8470).Nested
ifexpressions that arise from the keywordelseifnow useelseifas their expression head instead ofif(#21774).letblocks now parse the same asforloops; the first argument is either an assignment orblockof assignments, and the second argument is a block of statements (#21774).dosyntax now parses to an expression with head:do, instead of as a function call (#21774).Parsed and lowered forms of type definitions have been synchronized with their new keywords (#23157). Expression heads are renamed as follows:
type=>structbitstype=>primitive(order of arguments is also reversed, to match syntax)composite_type=>struct_typebits_type=>primitive_type
The
globalkeyword 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 containssineagerly, rather than delaying that decision untilfis run. (#22984).global constdeclarations may no longer appear inside functions (#12010).Uninitialized
BitArrayconstructors of the formBitArray[{N}](shape...)have been deprecated in favor of equivalents acceptingundef(an alias forUndefInitializer()) as their first argument, as inBitArray[{N}](undef, shape...). For example,BitVector(3)is nowBitVector(undef, 3),BitMatrix((2, 4))is nowBitMatrix(undef, (2, 4)), andBitArray{3}(11, 13, 17)is nowBitArray{3}(undef, 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 throwUndefVarErrorwhen 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)constdeclarations 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 variableialready existed it would be overwritten during the loop. This behavior is deprecated, and in the futureforloop 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,xused to be evaluated in a new scope enclosing theforloop. Now it is evaluated in the scope outside theforloop.In
for i in x, j in y, all variables now have fresh bindings on each iteration of the innermost loop. For example, an assignment toiwill not be visible on the nextjloop iteration (#330).Variable bindings local to
whileloop bodies are now freshly allocated on each loop iteration, matching the behavior offorloops.Prefix
&for by-reference arguments toccallhas been deprecated in favor ofRefargument types (#6080).The constructor
Ref(x::T)now always returns aRef{T}(#21527).All line numbers in ASTs are represented by
LineNumberNodes; the:lineexpression head is no longer used.QuoteNodes are also consistently used for quoted symbols instead of the:quoteexpression head (though:quoteExprs are still used for quoted expressions) (#23885).The
+and-methods forNumberandUniformScalingare not ambiguous anymore since+and-no longer do automatic broadcasting. Hence, the methods forUniformScalingandNumberare no longer deprecated (#23923).The keyword
importallis deprecated. Useusingand/or individualimportstatements instead (#22789).reduce(+, [...])andreduce(*, [...])no longer widen the iterated over arguments to system word size.sumandprodstill 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).
reprmime(mime, x)has been renamed torepr(mime, x), and along withrepr(x)andsprintit now accepts an optionalcontextkeyword forIOContextattributes.stringmimehas been moved to the Base64 stdlib package (#25990).The syntax
(x...)for constructing a tuple is deprecated; use(x...,)instead (#24452).Non-parenthesized interpolated variables in strings, e.g.
"$x", must be followed by a character that will never be an allowed identifier character (currently operators, space/control characters, or common punctuation characters) (#25231).The syntax
using A.Bcan now only be used whenA.Bis a module, and the syntaxusing A: Bcan only be used for adding single bindings (#8000).=>now has its own precedence level, giving it strictly higher precedence than=and,(#25391).The conditions under which unary operators followed by
(are parsed as prefix function calls have changed (#26154).beginis disallowed inside indexing expressions, in order to enable the syntaxa[begin](for selecting the first element) in the future (#23354).Underscores for
_italics_and__bold__are now supported by the Base Markdown parser. (#25564)…(\dots) and⁝(\tricolon) are now parsed as binary operators (#26262).Assignment syntax (
a=b) inside square bracket expressions (e.g.A[...],[x, y]) is deprecated. It will likely be reclaimed in a later version for passing keyword arguments. Note this does not affect updating operators like+=(#25631).tryblocks withoutcatchorfinallyare no longer allowed. An explicit emptycatchblock should be written instead (#27554).AbstractArraytypes that use unconventional (not 1-based) indexing can now supportsize,length, and@inbounds. To optionally enforce conventional indices, you can@assert !has_offset_axes(A).Module pre-compilation is now the default for code loading. Adding a
__precompile__()declaration is no longer necessary, although__precompile__(false)can still be used to opt-out (#26991).
Breaking changes
This section lists changes that do not have deprecation warnings.
The package manager
Pkghas been replaced with a new one. See the manual entries on "Code Loading" and "Pkg" for documentation.replace(s::AbstractString, pat=>repl)for functionreplarguments formerly passed a substring toreplin all cases. It now passes substrings for string patternspat, but aCharfor character patterns (whenpatis aChar, collection ofChar, or a character predicate) (#25815).readuntilnow does not include the delimiter in its result, matching the behavior ofreadline. Passkeep=trueto get the old behavior (#25633).lumethods now return decomposition objects such asLUrather than tuples of arrays or tuples of numbers (#26997, #27159, #27212).schurmethods now return decomposition objects such asSchurandGeneralizedSchurrather than tuples of arrays (#26997, #27159, #27212).lqmethods now return decomposition objects such asLQrather than tuples of arrays (#26997, #27159, #27212).qrmethods now return decomposition objects such asQR,QRPivoted, andQRCompactWYrather than tuples of arrays (#26997, #27159, #27212).svdmethods now return decomposition objects such asSVDandGeneralizedSVDrather than tuples of arrays or tuples of numbers (#26997, #27159, #27212).countlinesnow always counts the last non-empty line even if it does not end with EOL, matching the behavior ofeachlineandreadlines(#25845).getindex(s::String, r::UnitRange{Int})now throwsStringIndexErroriflast(r)is not a valid index intos(#22572).ntuple(f, n::Integer)throwsArgumentErrorifnis negative. Previously an empty tuple was returned (#21697).⋮,⋱,⋰, and⋯are now parsed as binary operators, not ordinary identifiers.≔,≕, and⩴now parse with assignment rather than comparison precedence (#26262).Juxtaposing string literals (e.g.
"x"y) is now a syntax error (#20575).finalizer(function, object)now returnsobjectrather thannothing(#24679).The constructor of
SubStringnow checks if the requested view range is defined by valid indices in the parentAbstractString(#22511).Macro calls with
forexpressions 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 tosumas 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 thannothingwhen 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_PATHglobal when it was expanded.All macros receive an extra argument
__source__::LineNumberNodewhich 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).
getsocknameon aTCPSocketnow returns the locally bound address and port of the socket. Previously the address of the remote endpoint was being returned (#21825).The
~/.juliarc.jlfile has been moved to~/.julia/config/startup.jland/etc/julia/juliarc.jlfile has been renamed to/etc/julia/startup.jl(#26161).Using
ARGSwithinstartup.jlfiles or within a .jl file loaded with--loadwill no longer contain the script name as the first argument. Instead, the script name will be assigned toPROGRAM_FILE. (#22092)The format for a
ClusterManagerspecifying 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
CartesianRangehas changed to a tuple-of-AbstractUnitRanges; thestartandstopfields are no longer present. Usefirst(R)andlast(R)to obtain start/stop. (#20974)The
Diagonal,Bidiagonal,TridiagonalandSymTridiagonaltype 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).The immediate supertype of
BitArrayis now simplyAbstractArray.BitArrayis no longer considered a subtype ofDenseArrayandStridedArray(#25858).When called with an argument that contains
NaNelements,findminandfindmaxnow return the firstNaNfound and its corresponding index. Previously,NaNelements 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 + ..., andrtoldefaults to zero if anatol > 0is 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_alltopology. Use keyword arglazy=falseto force all connections to be setup during aaddprocscall. (#22814)In
joinpath(a, b)on Windows, if the drive specifications ofaandbdo not match,joinpathnow returnsbinstead 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 aDomainErrorifp < 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
promotefunction 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).indminandindmaxhave been renamed toargminandargmax, respectively (#25654).findmin,findmax,argmin, andargmaxused to always return linear indices. They now returnCartesianIndexes for all but 1-d arrays, and in general return thekeysof indexed collections (e.g. dictionaries) (#22907).The
openspecfunlibrary is no longer built and shipped with Julia, as it is no longer used internally (#22390).All loaded packages 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 Packageorimport Package(#17997).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-Lwill be executed in the order given on the command line (#23665).Inow yieldsUniformScaling{Bool}(true)rather thanUniformScaling{Int64}(1)to better preserve types in operations involvingI(#24396).The return type of
reinterprethas changed toReinterpretArray.reinterpreton sparse arrays has been discontinued.Base.find_in_pathis nowBase.find_packageorBase.find_source_file(#24320).finalizernow 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 areFunctions orPtr{Cvoid}s (#24605).The
killfunction 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_runningfunction to determine if a process has already exited.The logging system has been redesigned -
infoandwarnare deprecated and replaced with the logging macros@info,@warn,@debugand@error. Theloggingfunction is also deprecated and replaced withAbstractLoggerand the functions from the new standardLogginglibrary. (#24490)The
RevStringtype has been removed from the language;reverse(::String)returns aStringwith code points (or fragments thereof) in reverse order. In general,reverse(s)should return a string of the same type and encoding asswith code points in reverse order; any string type overridesreverseto return a different type of string must also overridereverseindto compute reversed indices correctly.eachindex(A, B...)now requires that all inputs have the same number of elements. When the chosen indexing is Cartesian, they must have the same axes.AbstractRangeobjects are now considered as equal to otherAbstractArrayobjects by==andisequalif all of their elements are equal (#16401). This has required changing the hashing algorithm: ranges now use an O(N) fallback instead of a O(1) specialized method unless they define theBase.RangeStepStyletrait; see its documentation for details. Types which support subtraction (operator-) must now implementwidenfor hashing to work inside heterogeneous arrays.findn(x::AbstractArray)has been deprecated in favor offindall(!iszero, x), which now returns cartesian indices for multidimensional arrays (see below, #25532).Broadcasting operations are no longer fused into a single operation by Julia's parser. Instead, a lazy
Broadcastedobject is created to represent the fused expression and then realized withcopy(bc::Broadcasted)orcopyto!(dest, bc::Broadcasted)to evaluate the wrapper. Consequently, package authors generally need to specializecopyandcopyto!methods rather thanbroadcastandbroadcast!. This also allows for more customization and control of fused broadcasts. See the Interfaces chapter for more information.findhas been renamed tofindall.findall,findfirst,findlast,findnextnow take and/or return the same type of indices askeys/pairsforAbstractArray,AbstractDict,AbstractString,TupleandNamedTupleobjects (#24774, #25545). In particular, this means that they useCartesianIndexobjects for matrices and higher-dimensional arrays instead of linear indices as was previously the case. UseLinearIndices(a)[findall(f, a)]and similar constructs to compute linear indices.The
find*functions, i.e.findnext,findprev,findfirst, andfindlast, as well asindexin, now returnnothingwhen no match is found rather than0or0:-1(#25472, #25662, #26149)The
Base.HasShapeiterator trait has gained a type parameterNindicating the number of dimensions, which must correspond to the length of the tuple returned bysize(#25655).AbstractSetobjects are now considered equal by==andisequalif all of their elements are equal (#25368). This has required changing the hashing algorithm forBitSet.the default behavior of
titlecaseis changed in two ways (#23393):- characters not starting a word are converted to lowercase; a new keyword argument
strictis added which allows to get the old behavior when it'sfalse. - any non-letter character is considered as a word separator; to get the old behavior (only "space" characters are considered as word separators), use the keyword
wordsep=isspace.
- characters not starting a word are converted to lowercase; a new keyword argument
writedlmin the standard library module DelimitedFiles now writes numeric values usingprintrather thanprint_shortest(#25745).The
tempnamefunction used to create a file on Windows but not on other platforms. It now never creates a file (#9053).The
fieldnamesandpropertynamesfunctions now return a tuple rather than an array (#25725).indexinnow returns the first rather than the last matching index (#25998).parse(::Type, ::Char)now uses a default base of 10, like other number parsing methods, instead of 36 (#26576).isequalforPtrs now compares element types;==still compares only addresses (#26858).widenon 8- and 16-bit integer types now widens to 16- and 32-bit types, respectively. (#28045).mv,cp,touch,mkdir,mkpath,chmodandchownnow return the path that was created/modified rather thannothing(#27071).Regular expressions now default to UCP mode. Escape sequences such as
\wwill now match based on unicode character properties, e.g.r"\w+"will matchcafé(not justcaf). Add theamodifier (e.g.r"\w+"a) to restore the previous behavior (#27189).@syncnow waits only for lexically enclosed (i.e. visible directly in the source text of its argument)@asyncexpressions. If you need to wait for a task created by a called functionf, havefreturn the task and put@async wait(f(...))within the@syncblock. This change makes@scheduleredundant with@async, so@schedulehas been deprecated (#27164).norm(A::AbstractMatrix, p=2)computes no longer the operator/matrix norm but thenormofAas for other iterables, i.e. as if it were a vector. Especially,norm(A::AbstractMatrix)is the Frobenius norm. To compute the operator/matrix norm, use the new functionopnorm(#27401).dot(u, v)now acts recursively. Instead ofsum(u[i]' * v[i] for i in ...), it computessum(dot(u[i], v[i]) for i in ...), similarly tovecdotbefore (#27401).Sys.CPU_COREShas been renamed toSys.CPU_THREADS; it still gives the number of "logical cores" (including hyperthreading) rather than the number of physical cores present on the CPU. Similarly, the environment variableJULIA_CPU_CORESis deprecated in favor ofJULIA_CPU_THREADS(#27856).WeakKeyDictdoes not convert keys on insertion anymore (#24941).
Library improvements
The function
thisind(s::AbstractString, i::Integer)returns the largest valid index less or equal thaniin the stringsor0if no such index exists (#24414).Support for Unicode 11 (#28266).
Charis now a subtype ofAbstractChar, and most of the functions that take character arguments now accept anyAbstractChar(#26286).pathof(module)returns the path a module was imported from (#28310).bytes2hexnow accepts an optionalioargument to output to a hexadecimal stream without allocating aStringfirst (#27121).String(array)now accepts an arbitraryAbstractVector{UInt8}. ForVectorinputs, it "steals" the memory buffer, leaving them with an empty buffer which is guaranteed not to be shared with theStringobject. For other types of vectors (in particular immutable vectors), a copy is made and the input is not truncated (#26093).Irrationalis now a subtype ofAbstractIrrational(#24245).Introduced the
emptyfunction, the functional pair toempty!which returns a new, empty container (#24390).Jump to first/last history entries in the REPL via "Alt-<" and "Alt->" (#22829).
REPL LaTeX-like tab completions have been simplified for several Unicode characters, e.g.
𝔸is now\bbArather than\BbbA(#25980).The function
chopnow accepts two argumentsheadandtailallowing to specify number of characters to remove from the head and tail of the string (#24126).get(io, :color, false)can now be used to query whether a streamiosupports ANSI color codes (#25067), rather than using the undocumentedBase.have_colorglobal flag.print_with_colorhas been deprecated in favor ofprintstyled([io], xs...; bold=false, color=:normal)for printing styled text (#25522).Functions
firstandlastnow acceptncharargument forAbstractString. If this argument is used they return a string consisting of first/lastncharcharacters from the original string (#23960).Expressions
x^-nwherenis an integer literal now correspond toinv(x)^n. For example,x^-1is 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 typesTcan implementstartetc. forIterators.Reverse{T}to support this.The functions
nextindandprevindnow acceptncharargument that indicates the number of characters to move (#23805).The functions
strip,lstripandrstripnow returnSubString(#22496).The functions
strwidthandcharwidthhave been merged intotextwidth(#20816).The functions
baseanddigitsdigits now accept a negative base (likendigitsdid) (#21692).The function
randnnow accepts complex arguments (Complex{T <: AbstractFloat}) (#21973).parse(Complex{T}, string)can parse complex numbers in some common formats (#24713).The function
randcan now pick up random elements from strings, associatives and sets (#22228, #21960, #18155, #22224).It's now possible to specify the characters to pick from in the
randstringfunction (#22222).Allow multidimensional arrays in
shuffleandshuffle!functions (#22226).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).getpeernameon aTCPSocketreturns 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
crc32cfunction 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
versioninfois now controlled with keyword arguments (#21974).The function
LibGit2.set_remote_urlnow 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).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}inBasehas been replaced withVal{c}(), which is now easily accessible via the efficient 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,catandcat_t.A new
@macroexpand1macro for non recursive macro expansion (#21662).Chars can now be concatenated withStrings and/or otherChars using*(#22532).Diagonal,Bidiagonal,TridiagonalandSymTridiagonalare now parameterized on the type of the wrapped vectors, allowingDiagonal,Bidiagonal,TridiagonalandSymTridiagonalmatrices with arbitraryAbstractVectors (#22718, #22925, #23035, #23154).Mutating versions of
randpermandrandcyclehave been added:randperm!andrandcycle!(#22723).BigFloatrandom numbers can now be generated (#22720).The efficiency of random generation for MersenneTwister RNGs has been improved for integers,
Float64and ranges; as a result, given a seed, the produced stream of numbers has changed (#27560, #25277, #25197, #25058, #25047).REPL Undo via Ctrl-/ and Ctrl-_
diagmnow accepts several diagonal index/vectorPairs (#24047).isequal,==, andinhave one argument "curried" forms. For exampleisequal(x)returns a function that compares its argument toxusingisequal(#26436).reinterpretnow works on any AbstractArray using the newReinterpretArraytype. 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
keysof anAssociativeare now anAbstractSet.Base.KeyIterator{<:Associative}has been changed toKeySet{K, <:Associative{K}} <: AbstractSet{K}(#24580).New function
ncodeunits(s::AbstractString)gives the number of code units in a string. The generic definition is constant time but callslastindex(s)which may be inefficient. Therefore custom string types may want to define directncodeunitsmethods.reverseind(s::AbstractString, i::Integer)now has an efficient generic fallback, so custom string types do not need to provide their own efficient definitions. The generic definition relies onncodeunitshowever, so for optimal performance you may need to define a custom method for that function.The global RNG is being re-seeded with its own seed at the beginning of each
@testset, and have its original state restored at the end (#24445). This is breaking for testsets relying implicitly on the global RNG being in a specific state.permutedims(m::AbstractMatrix)is now short forpermutedims(m, (2,1)), and is now a more convenient way of making a "shallow transpose" of a 2D array. This is the recommended approach for manipulating arrays of data, rather than the recursively defined, linear-algebra functiontranspose. Similarly,permutedims(v::AbstractVector)will create a row matrix (#24839).A new
replace(A, old=>new)function is introduced to replaceoldbynewin collectionA. There is also another method with a different API, and a mutating variant,replace!(#22324, #25697, #26206, #27944).Adding integers to
CartesianIndexobjects is now deprecated. Instead ofi::Int + x::CartesianIndex, usei*one(x) + x(#26284).CartesianRangechanges (#24715):- Inherits from
AbstractArray, and linear indexing can be used to provide linear-to-cartesian conversion (#24715) - It has a new constructor taking an array
- Inherits from
several missing set-like operations have been added (#23528):
union,intersect,symdiff,setdiffare now implemented for all collections with arbitrary many arguments, as well as the mutating counterparts (union!etc.). The performance is also much better in many cases. Note that this change is slightly breaking: all the non-mutating functions always return a new object even if only one argument is passed. Moreover the semantics ofintersectandsymdiffis changed for vectors:intersectdoesn't preserve the multiplicity anymore (usefilterfor the old behavior)symdiffhas been made consistent with the corresponding methods for other containers, by taking the multiplicity of the arguments into account. Useuniqueto get the old behavior.
The
linearindicesfunction has been deprecated in favor of the newLinearIndicestype, which additionally provides conversion from cartesian indices to linear indices using the normal indexing operation. (#24715, #26775).IdDict{K,V}replacesObjectIdDict. It has type parameters like otherAbstractDictsubtypes and its constructors mirror the ones ofDict. (#25210)IOBuffercan take thesizehintkeyword argument to suggest a capacity of the buffer (#25944).lstripandrstripnow accept a predicate function that defaults toisspace(#27309).trunc,floor,ceil, androundspecifydigits,sigdigitsandbaseusing keyword arguments. (#26156, #26670)Sys.which()provides a cross-platform method to find executable files, similar to the Unixwhichcommand. (#26559)Added an optimized method of
vecdotfor taking the Frobenius inner product of sparse matrices. (#27470)Added an optimized method of
kronfor taking the tensor product of twoDiagonalmatrices. ([27581])An official API for extending
randis now defined (#23964, #25002).The constructor
MersenneTwister()is re-enabled, producing a randomly initialized RNG (similar toRandom.seed!(MersenneTwister(0))) (#21909).BitSetcan now store anyInt(instead of only positive ones) (#25029).The initial element
v0inreduce(op, v0, itr)has been replaced with aninitoptional keyword argument, as inreduce(op, itr; init=v0). Similarly forfoldl,foldr,mapreduce,mapfoldl,mapfoldr,accumulateandaccumulate!. (#27711, #27859)
Compiler/Runtime improvements
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)
Inference recursion-detection heuristics are now more precise, allowing them to be triggered less often, but being more aggressive when they are triggered to drive the inference computation to a solution (#23912).
Inference now propagates constants inter-procedurally, and can compute various constants expressions at compile-time (#24362).
The LLVM SLP Vectorizer optimization pass is now enabled at the default optimization level.
Deprecated or removed
The
JULIA_HOMEenvironment variable has been renamed toJULIA_BINDIRandBase.JULIA_HOMEhas been moved toSys.BINDIR(#20899).The keyword
immutableis fully deprecated tostruct, andtypeis fully deprecated tomutable struct(#19157, #20418).lufact,schurfact,lqfact,qrfact,ldltfact,svdfact,bkfact,hessfact,eigfact, andcholfacthave respectively been deprecated tolu,schur,lq,qr,ldlt,svd,bunchkaufman,hessenberg,eigen, andcholesky(#26997, #27159, #27212).lufact!,schurfact!,lqfact!,qrfact!,ldltfact!,svdfact!,bkfact!,hessfact!, andeigfact!have respectively been deprecated tolu!,schur!,lq!,qr!,ldlt!,svd!,bunchkaufman!,hessenberg!, andeigen!(#26997, #27159, #27212).eig(A[, args...])has been deprecated in favor ofeigen(A[, args...]). Whereas the former returns a tuple of arrays, the latter returns anEigenobject. So for a direct replacement, use(eigen(A[, args...])...,). But going forward, consider using the direct result ofeigen(A[, args...])instead, either destructured into its components (vals, vecs = eigen(A[, args...])) or as anEigenobject (X = eigen(A[, args...])) (#26997, #27159, #27212).eig(A::AbstractMatrix, B::AbstractMatrix)andeig(A::Number, B::Number)have been deprecated in favor ofeigen(A, B). Whereas the former each return a tuple of arrays, the latter returns aGeneralizedEigenobject. So for a direct replacement, use(eigen(A, B)...,). But going forward, consider using the direct result ofeigen(A, B)instead, either destructured into its components (vals, vecs = eigen(A, B)), or as aGeneralizedEigenobject (X = eigen(A, B)) (#26997, #27159, #27212).ordschur(T::StridedMatrix{Ty}, Z::StridedMatrix{Ty}, select::Union{Vector{Bool},BitVector})andordschur(S::StridedMatrix{Ty}, T::StridedMatrix{Ty}, Q::StridedMatrix{Ty}, Z::StridedMatrix{Ty}, select::Union{Vector{Bool},BitVector})and their respective inplace versions have been deprecated. Useordschur(schur::Schur, select::Union{Vector{Bool},BitVector})andordschur(gschur::GeneralizedSchur, select::Union{Vector{Bool},BitVector})instead (#28155).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).
The use of a positional dimension argument has largely been deprecated in favor of a
dimskeyword argument. This includes the functionssum,prod,maximum,minimum,all,any,findmax,findmin,mean,varm,std,var,cov,cor,median,mapreducedim,reducedim,sort,accumulate,accumulate!,cumsum,cumsum!,cumprod,cumprod!,flipdim,dropdims, andcat(#25501, #26660, #27100).indices(a)andindices(a,d)have been deprecated in favor ofaxes(a)andaxes(a, d)(#25057).EnvHashhas been renamed toEnvDict(#24167).Uninitialized
Arrayconstructors of the formArray[{T,N}](shape...)have been deprecated in favor of equivalents acceptingundef(an alias forUndefInitializer()) as their first argument, as inArray[{T,N}](undef, shape...). For example,Vector(3)is nowVector(undef, 3),Matrix{Int}((2, 4))is now,Matrix{Int}(undef, (2, 4)), andArray{Float32,3}(11, 13, 17)is nowArray{Float32,3}(undef, 11, 13, 17)(#24781).Previously
setindex!(A, x, I...)(and the syntaxA[I...] = x) supported two different modes of operation when supplied with a set of non-scalar indicesI(e.g., at least one index is anAbstractArray) depending upon the value ofxon the right hand side. Ifxis anAbstractArray, its contents are copied elementwise into the locations inAselected byIand it must have the same number of elements asIselects locations. Otherwise, ifxis not anAbstractArray, then its value is implicitly broadcast to all locations to all locations inAselected byI. This latter behavior—implicitly broadcasting "scalar"-like values across many locations—is now deprecated in favor of explicitly using the broadcasted assignment syntaxA[I...] .= xorfill!(view(A, I...), x)(#26347).broadcast_getindex(A, I...)andbroadcast_setindex!(A, v, I...)are deprecated in favor ofgetindex.((A,), I...)andsetindex!.((A,), v, I...), respectively (#27075).LinAlg.fillslots!has been renamedLinAlg.fillstored!(#25030).fill!(A::Diagonal, x)andfill!(A::AbstractTriangular, x)have been deprecated in favor ofBase.LinAlg.fillstored!(A, x)(#24413).eyehas been deprecated in favor ofIandMatrixconstructors. 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
Intbefore indexing if you intend to access index1fortrueand0forfalse.slicedim(A, d, i)has been deprecated in favor ofcopy(selectdim(A, d, i)). The newselectdimfunction now always returns a view intoA; in many cases thecopyis not necessary. Previously,slicedimon a vectorVover dimensiond=1and scalar indexiwould return the just selected element (unlessVwas aBitVector). This has now been made consistent:selectdimnow always returns a view into the original array, with a zero-dimensional view in this specific case (#26009).whoshas been renamedvarinfo, and now returns a markdown table instead of printing output (#12131).Uninitialized
RowVectorconstructors of the formRowVector{T}(shape...)have been deprecated in favor of equivalents acceptingundef(an alias forUndefInitializer()) as their first argument, as inRowVector{T}(undef, shape...). For example,RowVector{Int}(3)is nowRowVector{Int}(undef, 3), andRowVector{Float32}((1, 4))is nowRowVector{Float32}(undef, (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 anuplosymbol have been deprecated in favor of usingHermitian(orSymmetric) views (#22187, #22188).The
thinkeyword argument for orthogonal decomposition methods has been deprecated in favor offull, which has the opposite meaning:thin == trueif 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 accepteduploandissymmetricsymbols have been deprecated in favor of usingHermitian(orSymmetric) views (#22605).The function
current_moduleis deprecated and replaced with@__MODULE__. This caused the deprecation of some reflection methods (such asmacroexpandandisconst), 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. Forzeros(A), considerzero(A). Forones(A)orzeros(A), considerones(size(A)),zeros(size(A)),fill(v, size(A))forvan appropriate one or zero,fill!(copy(A), {1|0}),fill!(similar(A), {1|0}), or any of the preceding with different element type and/or shape depending onopts.... Where strictly necessary, considerfill!(similar(A[, opts...]), {one(eltype(A)) | zero(eltype(A))}). For an algebraic multiplicative identity, considerone(A)(#24656).The
similar(dims->f(..., dims...), [T], axes...)method to add offset array support to a functionfthat would otherwise create a non-offset array has been deprecated. Instead, callf(..., axes...)directly and, if needed, the offset array implementation should add offset axis support to the functionfdirectly (#26733).The functions
onesandzerosused to accept any objects as dimensional arguments, implicitly converting them toInts. This is now deprecated; onlyIntegers orAbstractUnitRanges are accepted as arguments. Instead, convert the arguments before callingonesorzeros(#26733).The variadic
size(A, dim1, dim2, dims...)method to return a tuple of multiple dimension lengths ofAhas been deprecated (#26862).The
Operatorsmodule 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
correctedpositional argument tocovhas 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 : brather thanx?a:b(#22523 and #22712).?can no longer be used as an identifier name (#22712)The method
replace(s::AbstractString, pat, r, [count])is deprecated in favor ofreplace(s::AbstractString, pat => r; [count])(#25165). Moreover,countcannot be negative anymore (usetypemax(Int)instead (#22325).read(io, type, dims)is deprecated toread!(io, Array{type}(undef, dims))(#21450).read(::IO, ::Ref)is now a method ofread!, since it mutates itsRefargument (#21592).nb_availableis nowbytesavailable(#25634).skipchars(io::IO, predicate; linecomment=nothing)is deprecated in favor ofskipchars(predicate, io::IO; linecomment=nothing)(#25667).Bidiagonalconstructors now use aSymbol(:Uor:L) for the upper/lower argument, instead of aBoolor aChar(#22703).Bidiagonal,TridiagonalandSymTridiagonalconstructors that automatically converted the input vectors to the same type are deprecated in favor of explicit conversion (#22925, #23035, #23154.Calling
nfieldson a type to find out how many fields its instances have is deprecated. Usefieldcountinstead. Usenfieldsonly to get the number of fields in a specific object (#22350).fieldnamesnow operates only on types. To get the names of fields in an object, usefieldnames(typeof(x))(#22350).InexactError,DomainError, andOverflowErrornow 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, andeachlinethat accepted both aCmdobject and an input stream are deprecated. Use e.g.read(pipeline(stdin, cmd))instead (#22762).The unexported type
AbstractIOBufferhas been renamed toGenericIOBuffer(#17360#22796).IOBuffer(data::AbstractVector{UInt8}, read::Bool, write::Bool, maxsize::Integer),IOBuffer(read::Bool, write::Bool), andIOBuffer(maxsize::Integer)are deprecated in favor of constructors taking keyword arguments (#25872).Displayhas been renamed toAbstractDisplay(#24831).Remaining vectorized methods over
SparseVectors, particularlyfloor,ceil,trunc,round, and most common transcendental functions such asexp,log, andsinvariants, have been deprecated in favor of dot-syntax (#22961).The method
String(io::IOBuffer)is deprecated toString(take!(copy(io)))(#21438).The function
readstringis deprecated in favor ofread(io, String)(#22793)The function
showallis deprecated. Showing entire values is the default, unless anIOContextspecifying:limit=>trueis in use (#22847).issubtypehas been deprecated in favor of<:(which used to be an alias forissubtype).Calling
writeon non-isbits arrays is deprecated in favor of explicit loops orserialize(#6466).The default
startup.jlfile on Windows has been removed. Now must explicitly include the full path if you need access to executables or libraries in theSys.BINDIRdirectory, e.g.joinpath(Sys.BINDIR, "7z.exe")for7z.exe(#21540).sqrtmhas been deprecated in favor ofsqrt(#23504).expmhas been deprecated in favor ofexp(#23233).logmhas been deprecated in favor oflog(#23505).fullhas 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, orAbstractTriangularmatricesA, consider insteadMatrix(S),Array(S),SparseMatrixCSC(S), orsparse(S). OnSymmetricmatricesAparticularly, consider insteadLinAlg.copytri!(copy(parent(A)), A.uplo). OnHermitianmatricesAparticularly, consider insteadLinAlg.copytri!(copy(parent(A)), A.uplo, true). OnUpperTriangularmatricesAparticularly, consider insteadtriu!(copy(parent(A))). OnLowerTriangularmatricesAparticularly, consider insteadtril!(copy(parent(A)))(#24250).speyehas been deprecated in favor ofI,sparse, andSparseMatrixCSCconstructor methods (#24356).Calling
unionwith no arguments is deprecated; construct an empty set with an appropriate element type usingSet{T}()instead (#23144).Vectorized
DateTime,Date, andformatmethods have been deprecated in favor of dot-syntax (#23207).Base.cpadhas been removed; use an appropriate combination ofrpadandlpadinstead (#23187).ctransposeandctranspose!have been deprecated in favor ofadjointandadjoint!, respectively (#23235).filterandfilter!on dictionaries now pass a singlekey=>valuepair 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.SpDiagIteratorhas been removed (#23261).The function
cfunction, has been deprecated in favor of a macro form@cfunction. Most existing uses can be upgraded simply by adding a@. The new syntax now additionally supports allocating closures at runtime, for dealing with C APIs that don't provide a separatevoid* env-type callback argument. (#26486)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,φandgoldenhave been moved fromBaseto a new module;Base.MathConstants. Onlyπ,piandℯ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_LIMBhave been renamed toGMP.version(),GMP.VERSION,GMP.bits_per_limb(), andGMP.BITS_PER_LIMB, 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!,selectpermandselectperm!have been renamed respectively topartialsort,partialsort!,partialsortpermandpartialsortperm!(#23051).The
Rangeabstract type has been renamed toAbstractRange(#23570).mapon dictionaries previously operated onkey=>valuepairs. This behavior is deprecated, and in the futuremapwill operate only on values (#5794).mapon sets previously returned aSet, possibly changing the order or number of elements. This behavior is deprecated and in the futuremapwill preserve order and number of elements (#26980).Previously, broadcast defaulted to treating its arguments as scalars if they were not arrays. This behavior is deprecated, and in the future
broadcastwill default to iterating over all its arguments. Wrap arguments you wish to be treated as scalars withRef()or a 1-tuple. Package developers can choose to allow a non-iterable typeTto always behave as a scalar by implementingbroadcastable(x::T) = Ref(x)(#26212).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).flipbits!(B)is deprecated in favor of using in-place broadcast to negate each element:B .= .!B(#27067).isleaftypeis deprecated in favor of the simpler predicatesisconcretetypeandisdispatchtuple. Concrete types are those that might equaltypeof(x)for somex;isleaftypeincluded some types for which this is not true. Those are now categorized more precisely as "dispatch tuple types" and "!hasfreetypevars" (not exported). (#17086, #25496)contains(eq, itr, item)is deprecated in favor ofanywith 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 newspdiagmimplementation now always returns a square matrix (#23757).spones(A::AbstractSparseArray)has been deprecated in favor ofLinAlg.fillstored!(copy(A), 1)(#25037).Constructors for
LibGit2.UserPasswordCredentialsandLibGit2.SSHCredentialswhich take aprompt_if_incorrectargument are deprecated. Instead, prompting behavior is controlled using theallow_promptkeyword in theLibGit2.CredentialPayloadconstructor (#23690).gradientis deprecated and will be removed in the next release (#23816).The timing functions
tic,toc, andtoqare deprecated in favor of@timeand@elapsed(#17046).Methods of
findfirst,findnext,findlast, andfindprevthat accept a value to search for are deprecated in favor of passing a predicate (#19186, #10593).findfunctions now operate only on booleans by default. To look for non-zeros, usex->x!=0or!iszero(#23120).The ability of
reinterpretto yieldArrays of different type than the underlying storage has been removed. Thereinterpretfunction is still available, but now returns aReinterpretArray. The three argument form ofreinterpretthat implicitly reshapes has been deprecated (#23750).bitshas been deprecated in favor ofbitstring(#24281, #24263).num2hexandhex2numhave been deprecated in favor ofreinterpretcombined withparse/hex(#22088).copy!is deprecated forAbstractSetandAbstractDict, with the intention to re-enable it with a cleaner meaning in a future version (#24844).copy!(resp.unsafe_copy!) is deprecated forAbstractArrayand is renamedcopyto!(resp.unsafe_copyto!); it will be re-introduced with a different meaning in a future version (#24808).a:bis deprecated for constructing aStepRangewhenaandbhave physical units (Dates and Times). Usea:s:b, wheres = Dates.Day(1)ors = Dates.Second(1).trues(A::AbstractArray)andfalses(A::AbstractArray)are deprecated in favor oftrues(size(A))andfalses(size(A))respectively (#24595).workspaceis discontinued, check out Revise.jl for an alternative workflow (#25046).cumsum,cumprod,accumulate, their mutating versions, anddiffall now require adimargument instead of defaulting to using the first dimension unless there is only one dimension (#24684, #25457).The
sum_kbnandcumsum_kbnfunctions have been moved to the KahanSummation package (#24869).isnumberhas been renamed toisnumeric(#25021).isalphahas been renamed toisletter(#26932).is_assigned_charandnormalize_stringhave been renamed toisassignedandnormalize, and moved to the newUnicodestandard library module.graphemeshas also been moved to that module (#25021).Sparse array functionality has moved to the
SparseArraysstandard library module (#25249).Linear algebra functionality, and specifically the
LinAlgmodule has moved to theLinearAlgebrastandard library module (#25571).@printfand@sprintfhave been moved to thePrintfstandard library (#23929,#25056).The
Libdlmodule has moved to theLibdlstandard library module (#25459).The aliases
Complex32,Complex64andComplex128have been deprecated in favor ofComplexF16,ComplexF32andComplexF64respectively (#24647).Base.parentindexesandSharedArrays.localindexeshave been renamed toparentindicesandlocalindices, respectively. Similarly, theindexesfield in theSubArraytype has been renamed toindiceswithout deprecation (#25088).Associativehas been deprecated in favor ofAbstractDict(#25012).Voidhas been renamed back toNothingwith an aliasCvoidfor use when calling C with a return type ofCvoidor a return or argument type ofPtr{Cvoid}(#25162).Nullable{T}has been deprecated and moved to the Nullables package (#23642). UseUnion{T, Nothing}instead, orUnion{Some{T}, Nothing}ifnothingis a possible value (i.e.Nothing <: T).isnull(x)can be replaced withx === nothingandunsafe_get/getcan be dropped or replaced withcoalesce.NullExceptionhas been removed.unshift!andshift!have been renamed topushfirst!andpopfirst!(#23902)ipermute!has been deprecated in favor ofinvpermute!(#25168).CartesianRangehas been renamedCartesianIndices(#24715).sub2indandind2subare deprecated in favor of usingCartesianIndicesandLinearIndices(#24715).getindex(F::Factorization, s::Symbol)(usually seen as e.g.F[:Q]) is deprecated in favor of dot overloading (getproperty) so factors should now be accessed as e.g.F.Qinstead ofF[:Q](#25184).searchandrsearchhave been deprecated in favor offindfirst/findnextandfindlast/findprevrespectively, in combination with curriedisequalandinpredicates for some methods (#24673).search(buf::IOBuffer, delim::UInt8)has been deprecated in favor of eitheroccursin(delim, buf)(to test containment) orreaduntil(buf, delim)(to read data up todelim) (#26600).ismatch(regex, str)has been deprecated in favor ofcontains(str, regex)(#24673).matchallhas been deprecated in favor ofcollect(m.match for m in eachmatch(r, s))(#26071).similar(::Associative)has been deprecated in favor ofempty(::Associative), andsimilar(::Associative, ::Pair{K, V})has been deprecated in favour ofempty(::Associative, K, V)(#24390).findin(a, b)has been deprecated in favor offindall(in(b), a)(#24673).module_namehas been deprecated in favor of a new, generalnameoffunction. Similarly, the unexportedBase.function_nameandBase.datatype_namehave been deprecated in favor ofnameofmethods (#25622).The module
Random.dSFMTis renamedRandom.DSFMT(#25567).Random.RandomDevice(unlimited::Bool)(on non-Windows systems) is deprecated in favor ofRandom.RandomDevice(; unlimited=unlimited)(#25668).The generic implementations of
strides(::AbstractArray)andstride(::AbstractArray, ::Int)have been deprecated. Subtypes ofAbstractArraythat implement the newly introduced strided array interface should define their ownstridesmethod (#25321).module_parent,Base.datatype_module, andBase.function_modulehave been deprecated in favor ofparentmodule([#TODO]).rand(t::Tuple{Vararg{Int}})is deprecated in favor ofrand(Float64, t)orrand(t...);rand(::Tuple)will have another meaning in the future (#25429, #25278).randjump, which produced an array, is deprecated in favor of the scalar versionFuture.randjumpused withaccumulate(#27746).The
assertfunction (and@assertmacro) have been documented that they are not guaranteed to run under various optimization levels and should therefore not be used to e.g. verify passwords.ObjectIdDicthas been deprecated in favor ofIdDict{Any,Any}(#25210).gcandgc_enablehave been deprecated in favor ofGC.gcandGC.enable(#25616).Base.@gc_preservehas been deprecated in favor ofGC.@preserve(#25616).print_shortesthas been discontinued, but is still available in theBase.Grisusubmodule (#25745).scale!has been deprecated in favor ofmul!,lmul!, andrmul!(#25701, #25812).The
remove_destinationkeyword argument tocp,mv, and the unexportedcptreehas been renamed toforce(#25979).containshas been deprecated in favor of a more generaloccursinfunction, which takes its arguments in reverse order fromcontains(#26283).Regexobjects are no longer callable. Useoccursininstead (#26283).The methods of
rangebased on positional arguments have been deprecated in favor of keyword arguments (#25896).linspacehas been deprecated in favor ofrangewithstopandlengthkeyword arguments (#25896).LinSpacehas been renamed toLinRange(#25896).logspacehas been deprecated to its definition (#25896).endof(a)has been renamed tolastindex(a), and theendkeyword in indexing expressions now lowers to eitherlastindex(a)(in the case with only one index) orlastindex(a, d)(in cases where there is more than one index andendappears at dimensiond) (#23554, #25763).DateTime(),Date(), andTime()have been deprecated, instead useDateTime(1),Date(1)andTime(0)respectively (#23724).The fallback method
^(x, p::Integer)is deprecated. If your type relied on this definition, add a method such as^(x::MyType, p::Integer) = Base.power_by_squaring(x, p)(#23332).DevNull,STDIN,STDOUT, andSTDERRhave been renamed todevnull,stdin,stdout, andstderr, respectively (#25786).waitandfetchonTasknow resemble the interface ofFuture.showcompact(io, x...)has been deprecated in favor ofshow(IOContext(io, :compact => true), x...)(#26080). Usesprint(show, x..., context=:compact => true)instead ofsprint(showcompact, x...).isupper,islower,ucfirstandlcfirsthave been deprecated in favor ofisuppercase,islowercase,uppercasefirstandlowercasefirst, respectively (#26442).signifhas been deprecated in favor of thesigdigitskeyword argument toround.Base.IntSethas been deprecated in favor ofBase.BitSet(#24282).setroundinghas been deprecated forFloat32andFloat64, as the behaviour was too unreliable (#26935).gamma,lgamma,beta,lbetaandlfacthave been moved to SpecialFunctions.jl (#27459, #27473).atan2is now a 2-argument method ofatan(#27248).The functions
eigsandsvdshave been moved to theArpack.jlpackage (#27616).vecdotandvecnormare deprecated in favor ofdotandnorm, respectively (#27401).clipboardhas been moved to theInteractiveUtilsstandard library package (along with other utilities mostly used at the interactive prompt, such aseditandless) (#27635).ndigits(n, b, [pad])is deprecated in favor ofndigits(n, base=b, pad=pad)(#27908).squeezeis deprecated in favor ofdropdims.srandis deprecated in favor of the unexportedRandom.seed!(#27726).realmin/realmaxare deprecated in favor offloatmin/floatmax(#28302).sortrows/sortcolshave been deprecated in favor of the more generalsortslices.nextpow2/prevpow2have been deprecated in favor of the more generalnextpow/prevpowfunctions.
Command-line option changes
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--quietoption implies--banner=noeven in REPL mode but can be overridden by passing--quiettogether with--banner=yes(#23342).The option
--precompiledhas been renamed to--sysimage-native-code(#23054).The option
--compilecachehas been renamed to--compiled-modules(#23054).