-
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 aUnionAlltype). 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) endthe 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).
-
immutablechanges tostruct -
typechanges tomutable struct -
abstractchanges toabstract type ... end -
bitstype 32 Charchanges toprimitive type Char 32 end
In 0.6,
immutableandtypeare 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 .⨳ bis now automatically equivalent to thebroadcastcall(⨳).(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).
-
isais 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
typealiaskeyword is deprecated, and should be replaced withVector{T} = Array{T,1}or aconstassignment (#20500). -
Experimental feature:
x^nfor integer literalsn(e.g.x^3orx^-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.
-
readline,readlinesandeachlinereturn 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). -
Strings no longer have a.datafield (as part of a significant performance improvement). UseVector{UInt8}(str)to access a string as a byte array. However, allocating theVectorobject has overhead. You can also usecodeunit(str, i)to access theith byte of aString. Usesizeof(str)instead oflength(str.data), andpointer(str)instead ofpointer(str.data)(#19449). -
Operations between
Float16andIntegersnow returnFloat16instead 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). -
broadcastnow handles tuples, and treats any argument that is not a tuple or an array as a "scalar" (#16986). -
broadcastnow produces aBitArrayinstead ofArray{Bool}for functions yielding a boolean result. If you wantArray{Bool}, usebroadcast!or.=(#17623). -
Broadcast
A[I...] .= Xwith entirely scalar indicesIis deprecated as its behavior will change in the future. UseA[I...] = Xinstead. -
Operations like
.+and.*onRangeobjects are now genericbroadcastcalls (see above) and produce anArray. If you want aRangeresult, use+and*, etcetera (#17623). -
broadcastnow treatsRef(except forPtr) arguments as 0-dimensional arrays (#18965). -
broadcastnow handles missing data (Nullables) allowing operations to be lifted over mixtures ofNullables and scalars, as if theNullablewere 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). -
rmprocsnow throws an exception if requested workers have not been completely removed beforewaitforseconds. With awaitfor=0,rmprocsreturns immediately without waiting for worker exits. -
quadgkhas been moved from Base into a separate package (#19741). -
The
Collectionsmodule has been removed, and all functions defined therein have been moved to theDataStructurespackage (#19800). -
The
RepStringtype 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 askwexpressions (#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.
\varepsilonnow tab-completes to U+03B5 (greek small letter epsilon) (#19464). -
retrynow inputs the keyword argumentsdelaysandcheckinstead ofnandmax_delay. The previous functionality can be achieved settingdelaystoExponentialBackOff(#19331). -
transpose(::AbstractVector)now always returns aRowVectorview of the input (which is a special 1×n-sizedAbstractMatrix), not aMatrix, etc. In particular, forv::AbstractVectorwe now have(v.').' === vandv.' * vis a scalar (#19670). -
Parametric types with "unspecified" parameters, such as
Array, are now represented asUnionAlltypes instead ofDataTypes (#18457). -
Uniontypes have two fields,aandb, instead of a singletypesfield. 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). -
FloatRangehas been replaced byStepRangeLen, and the internal representation ofLinSpacehas changed. Aside from changes in the internal field names, this leads to several differences in behavior (#18777):-
Both
StepRangeLenandLinSpacecan represent ranges of arbitrary object types---they are no longer limited to floating-point numbers. -
For ranges that produce
Float64,Float32, orFloat16numbers,StepRangeLencan 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 typeStepRangeLenrather thanLinSpacewhenstartandstopareFloatNN.LinSpace(start, stop, len)always returns aLinSpace. -
StepRangeLen(a, step, len)constructs an ordinary-precision range using the values and types ofaandstepas given, whereasrange(a, step, len)will attempt to match inputsa::FloatNNandstep::FloatNNto rationals and construct aStepRangeLenthat internally uses twice-precision arithmetic. These two outcomes exhibit differences in both precision and speed.
-
-
A=>Bexpressions are now parsed as calls instead of using=>as the expression head (#20327). -
The
countfunction no longer sums non-boolean values (#20404) -
The generic
getindex(::AbstractString, ::AbstractVector)method's signature has been tightened togetindex(::AbstractString, ::AbstractVector{<:Integer}). Consequently, indexing intoAbstractStrings with non-AbstractVector{<:Integer}AbstractVectors now throws aMethodErrorin the absence of an appropriate specialization. (Previously such cases failed less explicitly with the exception ofAbstractVector{Bool}, which now throws anArgumentErrornoting 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,airyxandairyprimehave 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
escs in the offending macro (#15850). -
writeon anIOBuffernow returns a signed integer in order to be consistent with other buffers (#20609). -
The
<:Integerdivision 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,@fetchand@fetchfromno longer implicitly localize variables. Previously, the expression would be wrapped in an implicitletblock (#19594). -
parseno 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
@spawnorremotecallnow 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). -
homedirnow 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
@viewsmacro 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 returnNaNforNaNarguments (#12563). -
oneunit(x)function to return a dimensionful version ofone(x)(which is clarified to mean a dimensionless quantity ifxis dimensionful) (#20268). -
The
chopandchompfunctions 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_colorcan 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_colorno longer prints text in bold by default (#18628). Instead, the function now take a keyword argumentbold::Boolwhich 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_COLORandJULIA_ANSWER_COLORto"bold". For example, one way of doing this is addingENV["JULIA_INPUT_COLOR"] = :boldandENV["JULIA_ANSWER_COLOR"] = :boldto the.juliarc.jlfile. 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_COLORto"blue"andJULIA_WARN_COLORto"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, andhvcatnow work withUniformScalingobjects, so you can now do e.g.[A I]and it will concatenate an appropriately sized identity matrix (#19305). -
New
accumulateandaccumulate!functions were added, which generalizecumsumandcumprod. Also known as a scan operation (#18931). -
reshapenow 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_indicesfunction 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 anArgumentErrorfor 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_indicesfunction. As a result, the type ofSubArrays that represent views over colon indices has changed. -
Logical indexing is now more efficient. Logical arrays are converted by
to_indicesto 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
CartesianIndexes is also improved in many situations.
-
-
A new
titlecasefunction was added, to capitalize the first character of each word within a string (#19469). -
anyandallnow always short-circuit, andmapreducenever 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, andmapreducewill visit all members of the iterable. -
Additional methods for
onesandzerosfunctions were added to support the same signature as thesimilarfunction (#19635). -
countnow has acount(itr)method equivalent tocount(identity, itr)(#20403). -
Methods for
mapandfilterwithNullablearguments have been implemented; the semantics are as if theNullablewere a container with zero or one elements (#16961). -
New
@test_warnand@test_nowarnmacros were added in theBase.Testmodule to test for the presence or absence of warning messages (#19903). -
loggingcan now be used to redirectinfo,warn, anderrormessages 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 whetherxis zero (or is all zeros, for an array) (#19950). -
notifynow 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.Timetype 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, raisingtrueto any negative integer power now yieldstruerather than throwing aDomainError(#18342). -
A new
@macroexpandmacro was added as a convenient alternative to themacroexpandfunction (#18660). -
invokenow supports keyword arguments (#20345). -
A new
ConjArraytype was added, as a wrapper type for lazy complex conjugation of arrays. Currently, it is used by default for the newRowVectortype only, and enforces that bothtranspose(vec)andctranspose(vec)are views not copies (#20047). -
remnow accepts aRoundingModeargument 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 IEE754remainderfunction. 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 ofbroadcastscalars,Vectors, orMatrixs, now efficiently yieldSparseVectors orSparseMatrixs 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). -
enumeratenow 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).
-
ccallis now implemented as a macro, removing the need for special code-generator support forIntrinsics(#18754). -
ccallgained limited support for allvmcallcalling-convention. This can replace many uses ofllvmcallwith a simpler, shorter declaration (#18754). -
All
Intrinsicsare nowBuiltinfunctions 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
dto linearly access the higher dimensions from arrayA(beyondsize(A, d)) has been deprecated as a stricter constraint during bounds checking. Instead,reshapethe 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
SubArrayconstructor (which acceptsdims::Tupleas its third argument) has been deprecated in favor of the two-argument equivalent (thedims::Tupleargument being superfluous) (#19259). -
ishas been deprecated in favor of===(which used to be an alias foris) (#17758). -
Ambiguous methods for addition and subtraction between
UniformScalings andNumbers, for example(+)(J::UniformScaling, x::Number), have been deprecated in favor of unambiguous, explicit equivalents, for exampleJ.λ + x(#17607). -
numanddenhave been deprecated in favor ofnumeratoranddenominatorrespectively (#19233,#19246). -
delete!(ENV::EnvDict, k::AbstractString, def)has been deprecated in favor ofpop!(ENV, k, def). Be aware thatpop!returnskordef, whereasdelete!returnsENVordef(#18012). -
infix operator
$has been deprecated in favor of infix⊻or functionxor(#18977). -
The single-argument form of
write(write(x), with implicitSTDOUToutput stream), has been deprecated in favor of the explicit equivalentwrite(STDOUT, x)(#17654). -
Dates.recurhas been deprecated in favor offilter(#19288) -
A number of ambiguous
convertoperations betweenNumbers (especiallyReals) andDate,DateTime, andPeriodtypes have been deprecated in favor of unambiguousconvertand explicit constructor calls. Additionally, ambiguous colon construction of<:Periodranges 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). -
cumminandcummaxhave been deprecated in favor ofaccumulate(#18931). -
The
Arrayconstructor syntaxArray(T, dims...)has been deprecated in favor of the formsArray{T,N}(dims...)(whereNis known, or particularlyVector{T}(dims...)forN = 1andMatrix{T}(dims...)forN = 2), andArray{T}(dims...)(whereNis not known). Likewise forSharedArrays (#19989). -
sumabsandsumabs2have been deprecated in favor ofsum(abs, x)andsum(abs2, x), respectively.maxabsandminabshave 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,consumeand iteration over a Task object have been deprecated in favor of using Channels for inter-task communication (#19841). -
The
negatekeyword has been deprecated from all functions in theDatesadjuster API (adjust,tonext,toprev,Date,Time, andDateTime). Instead use predicate function negation via the!operator (see Library Improvements) (#20213). -
@test_approx_eq x yhas 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 acceptAbstractStringshave 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:
LinearIndexingandlinearindexinghave been deprecated in favor ofIndexStyle.LinearFasthas been deprecated in favor ofIndexLinear, andLinearSlowhas 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). -
zerosandonesmethods 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_ophas been deprecated (#19669, #19814, #19937). -
isimaghas 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_typehas been deprecated (#19766). -
Methods allowing indexing of tuples by
AbstractArrays with more than one dimension have been deprecated. (Indexing a tuple by such a higher-dimensionalAbstractArrayshould yield a tuple with more than one dimension, but tuples are one-dimensional.) (#19737). -
@test_approx_eq a bhas been deprecated in favor of@test a ≈ b(or, equivalently,@test ≈(a, b)or@test isapprox(a, b)).@test_approx_eq_epshas been deprecated in favor of new@testsyntax:@testnow supports the syntax@test f(args...) key=val ...for@test f(args..., key=val...). This syntax allows, for example, writing@test a ≈ b atol=cin place of@test ≈(a, b, atol=c)(and hence@test_approx_eq_eps a b c) (#19901). -
takebuf_arrayhas been deprecated in favor oftake!, andtakebuf_string(x)has been deprecated in favor ofString(take!(x))(#19088). -
convertmethods fromDiagonalandBidiagonalto subtypes ofAbstractTriangularhave been deprecated (#17723). -
Base.LinAlg.arithtypehas been deprecated. If you were usingarithtypewithin apromote_opcall, 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
Channelconstructors (Channel(),Channel{T}()) have been deprecated in favor of equivalents accepting an explicitChannelsize (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_typemethod, consider defining it locally viaCore.Compiler.return_type(op, Tuple{Ts...})(#18642). -
bitbroadcasthas been deprecated in favor ofbroadcast, which now produces aBitArrayinstead ofArray{Bool}for functions yielding a boolean result (#19771). -
To complete the deprecation of histogram-related functions,
midpointshas been deprecated. Instead use the StatsBase.jl package'smidpointsfunction (#20058). -
Passing a type argument to
LibGit2.cathas been deprecated in favor of a simpler, two-argument method forLibGit2.cat(#20435). -
The
LibGit2.ownerfunction for finding the repository which owns a given Git object has been deprecated in favor ofLibGit2.repository(#20135). -
The
LibGit2.GitAnyObjecttype has been renamed toLibGit2.GitUnknownObjectto clarify its intent (#19935). -
The
LibGit2.GitOidtype has been renamed toLibGit2.GitHashfor clarity (#19878). -
Finalizing
LibGit2objects withfinalizehas been deprecated in favor of usingclose(#19660). -
Parsing string dates from a
Dates.DateFormatobject has been deprecated as part of a larger effort toward faster, more extensible date parsing (#20952).
- In
pollybuilds (USE_POLLY := 1), the new flag--polly={yes|no}controls whether@pollydeclarations are respected. (With--polly=no,@pollydeclarations are ignored.) This flag is also available in non-pollybuilds (USE_POLLY := 0), but has no effect (#18159).
-
Generator expressions:
f(i) for i in 1:n(#4470). This returns an iterator that computes the specified values on demand. This is useful for computing, e.g.sum(f(i) for i in 1:n)without creating an intermediate array of values. -
Generators and comprehensions support filtering using
if(#550) and nested iteration using multipleforkeywords (#4867). -
Fused broadcasting syntax:
f.(args...)is equivalent tobroadcast(f, args...)(#15032), and nestedf.(g.(args...))calls are fused into a singlebroadcastloop (#17300). Similarly, the syntaxx .= ...is equivalent to abroadcast!(identity, x, ...)call and fuses with nested "dot" calls; also,x .+= yand similar is now equivalent tox .= x .+ y, rather thanx = x .+ y(#17510). -
Macro expander functions are now generic, so macros can have multiple definitions (e.g. for different numbers of arguments, or optional arguments) (#8846, #9627). However note that the argument types refer to the syntax tree representation, and not to the types of run time values.
-
Varargs functions like
foo{T}(x::T...)may now restrict the number of such arguments usingfoo{T,N}(x::Vararg{T,N})(#11242). -
x ∈ Xis now a synonym forx in Xinforloops and comprehensions, as it already was in comparisons (#13824). -
The
PROGRAM_FILEglobal is now available for determining the name of the running script (#14114). -
The syntax
x.:sym(e.g.Base.:+) is now supported, while usingx.(:sym)orx.(i)for field access are deprecated in favor ofgetfield(#15032). -
Function return type syntax
function f()::Thas been added (#1090). Values returned from a function with such a declaration will be converted to the specified typeT. -
Many more operators now support
.prefixes (e.g..≤) (#17393). However, users are discouraged from overloading these, since they are mainly parsed in order to implement backwards compatibility with planned automatic broadcasting of dot operators in Julia 0.6 (#16285). Explicitly qualified operator names likeBase.≤should now useBase.:≤(prefixed by@compatif you need 0.4 compatibility via theCompatpackage). -
User-extensible bounds check elimination is now possible with the new
@boundscheckmacro (#14474). This macro marks bounds checking code blocks, which the compiler may remove when encountered inside an@inboundscall.
-
Support for multi-threading. Loops with independent iterations can be easily parallelized with the
Threads.@threadsmacro. -
Support for arrays with indexing starting at values different from 1. The array types are expected to be defined in packages, but now Julia provides an API for writing generic algorithms for arbitrary indexing schemes (#16260).
-
Each function and closure now has its own type. The captured variables of a closure are fields of its type.
Functionis now an abstract type, and is the default supertype of functions and closures. All functions, including anonymous functions, are generic and support all features (e.g. keyword arguments). Instead of adding methods tocall, methods are added by type using the syntax(::ftype)(...) = ....callis deprecated (#13412). A significant result of this language change is that higher order functions can be specialized on their function arguments, leading to much faster functional programming, typically as fast as if function arguments were manually inlined. See below for details. -
Square brackets and commas (e.g.
[x, y]) no longer concatenate arrays, and always simply construct a vector of the provided values. Ifxandyare arrays,[x, y]will be an array of arrays (#3737, #2488, #8599). -
usingandimportare now case-sensitive even on case-insensitive filesystems (common on Mac and Windows) (#13542). -
Relational algebra symbols are now allowed as infix operators (#8036):
⨝,⟕,⟖,⟗for joins and▷for anti-join. -
A warning is always given when a method is overwritten; previously, this was done only when the new and old definitions were in separate modules (#14759).
-
The
ifkeyword cannot be followed immediately by a line break (#15763). -
Juxtaposition of numeric literals ending in
.(e.g.1.x) is no longer allowed (#15731). -
The built-in
NTupletype has been removed;NTuple{N,T}is now implemented internally asTuple{Vararg{T,N}}(#11242). -
Use of the syntax
x::Tto declare the type of a local variable is deprecated. In the future this will always mean type assertion, and declarations should uselocal x::Tinstead (#16071). Whenxis global,x::T = ...andglobal x::Tused to mean type assertion, but this syntax is now reserved for type declaration (#964). -
Dictionary comprehension syntax
[ a=>b for x in y ]is deprecated. UseDict(a=>b for x in y)instead (#16510). -
Parentheses are no longer allowed around iteration specifications, e.g.
for (i = 1:n)(#17668).
This section lists changes that do not have deprecation warnings.
-
All dimensions indexed by scalars are now dropped, whereas previously only trailing scalar dimensions would be omitted from the result (#13612). This is a very major behavioral change, but should cause obvious failures. To retain a dimension sliced with a scalar
islice withi:iinstead. -
The assignment operations
.+=,.*=and so on now generate calls tobroadcast!on the left-hand side (or call toview(a, ...)on the left-hand side if the latter is an indexing expression, e.g.a[...]). This means that they will fail if the left-hand side is immutable (or does not supportview), and will otherwise change the left-hand side in-place (#17510, #17546). -
Method ambiguities no longer generate warnings when files are loaded, nor do they dispatch to an arbitrarily-chosen method; instead, a call that cannot be resolved to a single method results in a
MethodErrorat run time, rather than the previous definition-time warning (#6190). -
Array comprehensions preserve the dimensions of the input ranges. For example,
[2x for x in A]will have the same dimensions asA(#16622). -
The result type of an array comprehension depends only on the types of elements computed, instead of using type inference (#7258). If the result is empty, then type inference is still used to determine the element type.
-
reshapeis now defined to always share data with the original array. If a reshaped copy is needed, usecopy(reshape(a))orcopy!to a new array of the desired shape (#4211). -
mapslicesnow re-uses temporary storage. Recipient functions that expect input slices to be persistent should copy data to other storage (#17266). All usages ofmapslicesshould be carefully audited since this change can cause silent, incorrect behavior, rather than failing noisily. -
Local variables and arguments are represented in lowered code as numbered
Slotobjects instead of as symbols (#15609). -
The information that used to be in the
astfield of theLambdaStaticDatatype is now divided among the fieldscode,slotnames,slottypes,slotflags,gensymtypes,rettype,nargs, andisvain theLambdaInfotype (#15609). -
A <: Bis parsed asExpr(:(<:), :A, :B)in all cases (#9503). This also applies to the>:operator. -
Simple 2-argument comparisons like
A < Bare parsed as calls instead of using the:comparisonexpression type (#15524). The:comparisonexpression type is still produced in ASTs when comparisons are chained (e.g.A < B ≤ C). -
mapon a dictionary now expects a function that expects and returns aPair. The result is now another dictionary instead of an array (#16622). -
Bit shift operations (i.e.
<<,>>, and>>>) now handle negative shift counts differently: Negative counts are interpreted as shifts in the opposite direction. For example,4 >> -1 == 4 << +1 == 8. Previously, negative counts would implicitly overflow to large positive counts, always yielding either0or-1.
-
Strings (#16107):
-
The
UTF8StringandASCIIStringtypes have been merged into a singleStringtype (#16058). Useisascii(s)to check whether a string contains only ASCII characters. Theascii(s)function now convertsstoString, raising anArgumentErrorexception ifsis not pure ASCII. -
The
UTF16StringandUTF32Stringtypes and correspondingutf16andutf32converter functions have been removed from the standard library. If you need these types, they have been moved to the LegacyStrings.jl package. In the future, more robust Unicode string support will be provided by the StringEncodings.jl package. If you only need these types to call wide string APIs (UTF-16 on Windows, UTF-32 on UNIX), consider using the newtranscodefunction (see below) or theCwstringtype as accallargument type, which also ensures correct NUL termination of string data. -
A
transcode(T, src)function is now exported for converting data between UTF-xx Unicode encodings (#17323). -
The basic string construction routines are now
string(args...),String(s),unsafe_string(ptr)(formerlybytestring(ptr)), andunsafe_wrap(String, ptr)(formerlypointer_to_string) (#16731). -
Comparisons between
Chars andIntegers are now deprecated (#16024):'x' == 120now produces a warning but still evaluates totrue. In the future it may evaluate tofalseor the comparison may be an error. To compare characters with integers you should either convert the integer to a character value or convert the character to the corresponding code point first: e.g.'x' == Char(120)orInt('x') == 120. The former is usually preferable. -
Support for Unicode 9 (#17402).
-
-
Arrays and linear algebra:
-
Dimensions indexed by multidimensional arrays add dimensions. More generally, the dimensionality of the result is the sum of the dimensionalities of the indices (#15431).
-
New
normalizeandnormalize!convenience functions for normalizing vectors (#13681). -
QR matrix factorization:
-
A new
SparseVectortype allows for one-dimensional sparse arrays. Slicing and reshaping sparse matrices now return vectors when appropriate. Thesparsevecfunction returns a one-dimensional sparse vector instead of a one-column sparse matrix. TheSparseMatrixmodule has been renamed toSparseArrays(#13440). -
Rank one update and downdate functions,
lowrankupdate,lowrankupdate!,lowrankdowndate, andlowrankdowndate!, have been introduced for dense Cholesky factorizations (#14243, #14424). -
All
sparsemethods now retain provided numerical zeros as structural nonzeros; to drop numerical zeros, usedropzeros!(#14798, #15242). -
setindex!methods for sparse matrices and vectors no longer purge allocated entries on zero assignment. To drop stored entries from sparse matrices and vectors, useBase.SparseArrays.dropstored!(#17404). -
Concatenating dense and sparse matrices now returns a sparse matrix (#15172).
-
-
Files and I/O:
-
The
openfunction now respectsumaskon UNIX when creating files (#16466, #16502). -
A new function
walkdir()returns an iterator that walks the tree of a directory (#8814, #13707).for (root, dirs, files) in walkdir(expanduser("~/.julia/v0.5/Plots/src")) println("$(length(files)) \t files in $root") end 19 files in /Users/me/.julia/v0.5/Plots/src 15 files in /Users/me/.julia/v0.5/Plots/src/backends 4 files in /Users/me/.julia/v0.5/Plots/src/deprecated -
A new function
chown()changes the ownership of files (#15007). -
Display properties can now be passed among output functions (e.g.
show) using anIOContextobject (#13825). -
Cmd(cmd; ...)now accepts new Windows-specific optionswindows_verbatim(to alter Windows command-line generation) andwindows_hide(to suppress creation of new console windows) (#13780). -
There is now a default no-op
flush(io)function for allIOtypes (#16403).
-
-
Parallel computing:
-
pmapkeyword argumentserr_retry=trueanderr_stop=falseare deprecated. Action to be taken on errors can be specified via theon_errorkeyword argument. Retry is specified viaretry_n,retry_onandretry_max_delay(#15409, #15975, #16663). -
The functions
remotecall,remotecall_fetch, andremotecall_waitnow have the function argument as the first argument to allow for do-block syntax (#13338).
-
-
Statistics:
-
Testing:
-
The
Base.Testmodule now has a@testsetfeature to bundle tests together and delay throwing an error until the end (#13062). -
The new features are mirrored in the BaseTestNext.jl package for users who would like to use the new functionality on Julia v0.4.
-
The BaseTestDeprecated.jl package provides the old-style
handlerfunctionality, for compatibility with code that needs to support both Julia v0.4 and v0.5.
-
-
Package management:
-
The package system (
Pkg) is now based on thelibgit2library, rather than running thegitprogram, increasing performance (especially on Windows) (#11196). -
Package-development functions like
Pkg.tagandPkg.publishhave been moved to an external PkgDev package (#13387). -
Updating only a subset of the packages is now supported, e.g.
Pkg.update("Example")(#17132).
-
-
Miscellaneous:
-
Prime number related functions have been moved from
Baseto the Primes.jl package (#16481). -
Most of the combinatorics functions have been moved from
Baseto the Combinatorics.jl package (#13897). -
New
foreachfunction for calling a function on every element of a collection when the results are not needed (#13774). Compared tomap(f, v), which allocates and returns a result array,foreach(f, v)callsfon each element ofv, returning nothing. -
The new
Base.StackTracesmodule makes stack traces easier to use programmatically (#14469). -
The
libjulialibrary is now properly versioned and installed to the public<prefix>/libdirectory, instead of the private<prefix>/lib/juliadirectory (#16362). -
System reflection is now more consistently exposed from
Sysand notBase(e.g. constants such asWORD_SIZEandCPU_CORES).OS_NAMEhas been replaced bySys.KERNELand always reports the name of the kernel (as reported byuname). The@windows_onlyand@osxfamily of macros have been replaced with functions such asis_windows()andis_apple(). There is now also a@staticmacro that will evaluate the condition of an if-statement at compile time, for when a static branch is required (#16219). -
DateandDateTimevalues can now be rounded to a specified resolution (e.g., 1 month or 15 minutes) withfloor,ceil, andround(#17037).
-
-
Machine SIMD types can be represented in Julia as a homogeneous tuple of
VecElement(#15244). -
The performance of higher-order and anonymous functions has been greatly improved. For example,
map(x->2x, A)performs as well as2.*A(#13412). -
On windows, a DLL of standard library code is now precompiled and used by default, improving startup time (#16953).
-
LLVM has been upgraded to version 3.7.1, improving the quality of generated code and debug info. However compile times may be slightly longer (#14623).
This release greatly improves support for ARM, and introduces support for Power.
-
The following function names have been simplified and unified (#13232):
-
get_bigfloat_precision->precision(BigFloat) -
set_bigfloat_precision->setprecision -
with_bigfloat_precision->setprecision -
get_rounding->rounding -
set_rounding->setrounding -
with_rounding->setrounding
-
-
The method
A_ldiv_B!(SparseMatrixCSC, StridedVecOrMat)has been deprecated in favor of versions that require the matrix to be in factored form (#13496). -
chol(A,Val{:U/:L})has been deprecated in favor ofchol(A)(#13680). -
rem1(x,y)is discontinued due to inconsistency forx==0. Usemod1instead (#14140). -
The
FSmodule has been renamed toFilesystem. Calling the functionsisreadable,iswritable, andisexecutableon filesystem paths has been deprecated (#12819). -
RemoteRefhas been deprecated in favor ofRemoteChannel(#14458). -
superhas been renamed tosupertype(#14335). -
parseip(str)has been deprecated in favor ofparse(IPAddr, str)(#14676). -
readallhas been renamed toreadstring, andreadbyteshas been renamed toread(#14608, #14660). -
fieldoffsets(x)has been deprecated in favor of callingfieldoffset(x, i)on each field (#14777). -
issymis deprecated in favor ofissymmetricto match similar functions (ishermitian, ...) (#15192). -
scaleis deprecated in favor of eitherα*A,Diagonal(x)*A, orA*Diagonal(x)(#15258). -
"Functor" types are no longer necessary and have been deprecated (#15804). To maintain performance on older versions of Julia the Compat.jl package provides a
@functorizemacro. -
bitunpack(B)andbitpack(A)have been deprecated in favor ofArray(B)andBitArray(A), respectively (#16010). -
xdumpis removed, anddumpnow simply shows the full representation of a value.dumpshould not be overloaded, since it is for examining concrete structure (#4163). -
sprandboolhas been deprecated in favor ofsprand(Bool, ...)orsprand(rng, Bool, ...)(#11688, #16098). -
The lowercase
symbolfunction has been deprecated in favor of theSymbolconstructor (#16154). -
writemimeis deprecated, and output methods specifying a MIME type are now methods ofshow(#14052). -
BLAS utility functions
blas_set_num_threads,blas_vendor, andcheck_blashave been moved to the BLAS module asBLAS.set_num_threads,BLAS.vendor, andBLAS.check(#10548, #16600). -
print_escapedhas been renamed toescape_string,print_unescapedhas been renamed tounescape_string, andprint_joinedhas been renamed tojoin(#16603). -
pointer_to_stringhas been renamed tounsafe_wrap(String, ...), andpointer_to_arrayhas been renamed tounsafe_wrap(Array, ...)(#16731). -
subandslicehave been deprecated in favor ofview(#16972). -
Sparse matrix functions
etree,ereach,csc_permute, andsympermhave been moved to the SuiteSparse.jl package (#12231, #17033). -
The no-op
transposefallback for non-numeric arrays has been deprecated. Consider introducing suitabletransposemethods or callingpermutedims(x, (2, 1))for matrices andreshape(x, 1, length(x))for vectors. (#13171, #17075, #17374). -
The following macros have been deprecated (#16219):
@windowsis deprecated in favor ofis_windows()@unixis deprecated in favor ofis_unix()@osxis deprecated in favor ofis_apple()@linuxis deprecated in favor ofis_linux()@windows_onlyis deprecated in favor ofif is_windows()@unix_onlyis deprecated in favor ofif is_unix()@osx_onlyis deprecated in favor ofif is_apple()@linux_onlyis deprecated in favor ofif is_linux()- NOTE: Using
@staticcould be useful/necessary when used in a function's local scope. See details at the section entitled Handling Operating System Variation in the manual.
-
The
-Fflag to load~/.juliarchas been deprecated in favor of--startup-file=yes(#9482). -
The
-fand--no-startupflags to disable loading of~/.juliarchave been deprecated in favor of--startup-file=no(#9482). -
The
-Pand--post-bootflags for evaluating an expression in "interactive mode" have been deprecated in favor of-i -e(#16854). -
The
--no-history-fileflag to disable loading of~/.julia_historyhas been deprecated in favor of--history-file=no(#9482).
-
The Julia debugger makes its debut with this release. Install it with
Pkg.add("Gallium"), and the documentation should get you going. The JuliaCon talk on Gallium shows off various features of the debugger. -
The Juno IDE has matured significantly, and now also includes support for plotting and debugging.
-
Cxx.jl provides a convenient FFI for calling C++ code from Julia.
-
Function call overloading: for arbitrary objects
x(not of typeFunction),x(...)is transformed intocall(x, ...), andcallcan be overloaded as desired. Constructors are now a special case of this mechanism, which allows e.g. constructors for abstract types.T(...)falls back toconvert(T, x), so allconvertmethods implicitly define a constructor (#8712, #2403). -
Unicode version 8 is now supported for identifiers etcetera (#7917, #12031).
-
Type parameters now permit any
isbitstype, not justIntandBool(#6081). -
Keyword argument names can be computed, using syntax such as
f(; symbol => val)(#7704). -
The syntax
@generated functionenables generation of specialized methods based on argument types. At compile time, the function is called with its arguments bound to their types instead of to their values. The function then returns an expression forming the body of the function to be called at run time (#7311). -
Documentation system for functions, methods, types and macros in packages and user code (#8791).
-
The syntax
function foo endcan be used to introduce a generic function without yet adding any methods (#8283). -
Incremental precompilation of modules: call
VERSION >= v"0.4.0-dev+6521" && __precompile__()at the top of a module file to automatically precompile it when it is imported (#12491), or manually runBase.compilecache(modulename). The resulting precompiled.jifile is saved in~/.julia/lib/v0.4(#8745).-
See manual section on
Module initialization and precompilation(underModules) for details and errata. In particular, to be safely precompilable a module may need an__init__function to separate code that must be executed at runtime rather than precompile time. Modules that are not precompilable should call__precompile__(false). -
The precompiled
.jifile includes a list of dependencies (modules and files that were imported/included at precompile-time), and the module is automatically recompiled uponimportwhen any of its dependencies have changed. Explicit dependencies on other files can be declared withinclude_dependency(path)(#12458). -
New option
--output-incremental={yes|no}added to invoke the equivalent ofBase.compilecachefrom the command line.
-
-
The syntax
new{parameters...}(...)can be used in constructors to specify parameters for the type to be constructed (#8135). -
++is now parsed as an infix operator, but does not yet have a default definition (#11030, #11686). -
Support for inter-task communication using
Channels(#12264). See https://docs.julialang.org/en/latest/manual/parallel-computing/#channels for details. -
RemoteRefs now point to remote channels. The remote channels can be of length greater than 1. Default continues to be of length 1 (#12385). See https://docs.julialang.org/en/latest/manual/parallel-computing/#remoterefs-and-abstractchannels for details. -
@__LINE__special macro now available to reflect invocation source line number (#12727).
-
Tuple types are now written as
Tuple{A, B}instead of as(A, B). Tuples of bits types are inlined into structs and arrays, like other immutable types....now does splatting inside parentheses, instead of constructing a variadic tuple type (#10380). Variadic tuple types are written asTuple{Vararg{T}}. -
Using
[x,y]to concatenate arrays is deprecated, and in the future will construct a vector ofxandyinstead (#3737, #2488, #8599). -
Significant improvements to
ccallandcfunction-
As a safer alternative to creating pointers (
Ptr), the managed reference typeRefhas been added. ARefpoints to the data contained by a value in an abstract sense, and in a way that is GC-safe. For example,Ref(2)points to a storage location that contains the integer2, andRef(array,3)points to the third element of an array. ARefcan be automatically converted to a native pointer when passed to accall. -
When passing a by-reference argument to
ccall, you can declare the argument type to beRef{T}instead ofPtr{T}, and just passxinstead of&x. -
ccallis now lowered to callunsafe_convert(T, cconvert(T, x))on each argument.cconvertfalls back toconvert, but can be used to convert an argument to an arbitrarily-different representation more suitable for passing to C.unsafe_convertthen handles conversions toPtr. -
ccallandcfunctionnow support correctly passing and returning structs, following the platform ABI (assuming the C types are mirrored accurately in Julia). -
cfunctionarguments of struct-like Julia types are now passed by value. IfRef{T}is used as acfunctionargument type, it will look up the method applicable toT, but pass the argument by reference (as Julia functions usually do). However, this should only be used for objects allocated by Julia and forisbitstypes.
-
-
convert(Ptr,x)is deprecated for most types, replaced byunsafe_convert. You can stillconvertbetween pointer types, and between pointers andIntorUInt. -
Module
__init__methods no longer swallow thrown exceptions; they now throw anInitErrorwrapping the thrown exception (#12576). -
Unsigned
BigIntliteral syntax has been removed (#11105). Unsigned literals larger thanUInt128now throw a syntax error. -
error(::Exception)anderror(::Type{Exception})have been deprecated in favor of using an explicitthrow(#9690). -
Uintetcetera are renamed toUInt(#8905). -
Stringis renamed toAbstractString(#8872). -
FloatingPointis renamed toAbstractFloat(#12162). -
Noneis deprecated; useUnion{}instead (#8423). -
Nothing(the type ofnothing) is renamed toVoid(#8423). -
Arrays can be constructed with the syntax
Array{T}(m,n)(#3214, #10075). -
Dictliteral syntax[a=>b,c=>d]is replaced byDict(a=>b,c=>d),{a=>b}is replaced byDict{Any,Any}(a=>b), and(K=>V)[...]is replaced byDict{K,V}(...). The new syntax has many advantages: all of its components are first-class, it generalizes to other types of containers, it is easier to guess how to specify key and value types, and the syntaxes for empty and pre-populated dicts are synchronized. As part of this change,=>is parsed as a normal operator, andBasedefines it to constructPairobjects (#6739). -
Charis no longer a subtype ofInteger(#8816). Char now supports a more limited set of operations withIntegertypes:- comparison / equality
Char+Int=CharChar-Char=Int
-
roundrounds to the nearest integer using the default rounding mode, which is ties-to-even by default (#8750). -
A custom triple-quoted string like
x"""..."""no longer invokes anx_mstrmacro. Instead, the string is first unindented and thenx_stris invoked, as if the string had been single-quoted (#10228). -
Colons (
:) within indexing expressions are no longer lowered to the range1:end. Instead, the:identifier is passed directly. Custom array types that implementgetindexorsetindex!methods must also extend those methods to support arguments of typeColon(#10331). -
Unions of types should now be written with curly braces instead of parentheses, i.e.
Union{Type1, Type2}instead ofUnion(Type1, Type2)(#11432). -
The keyword
localis no longer allowed in global scope. Useletinstead ofbeginto create a new scope from the top level (#7234, #10472). -
Triple-quoted strings no longer treat tabs as 8 spaces. Instead, the longest common prefix of spaces and tabs is removed.
-
global xin a nested scope is now a syntax error ifxis local to the enclosing scope (#7264/#11985). -
The default
importall Base.Operatorsis deprecated, and relying on it will give a warning (#8113). -
remotecall_fetchandfetchnow rethrow any uncaught remote exception locally as aRemoteException. Previously they would return the remote exception object. The worker pid, remote exception and remote backtrace are available in the thrownRemoteException. -
If any of the enclosed async operations in a
@syncblock throw exceptions, they are now collected in aCompositeExceptionand theCompositeExceptionthrown.
-
The
-ioption now forces the REPL to run after loading the specified script (if any) (#11347). -
New option
--handle-signals={yes|no}to disable Julia's signal handlers. -
The
--depwarn={yes|no|error}option enables/disables syntax and method deprecation warnings, or turns them into errors (#9294). -
Some command line options are slated for deprecation / removal
-f, --no-startupDon't load ~/.juliarc (deprecated, use --startup-file=no)-FLoad ~/.juliarc (deprecated, use --startup-file=yes)`-P, --post-boot <expr>Evaluate , but don't disable interactive mode (deprecated, use -i -e instead)--no-history-fileDon't load history file (deprecated, use --history-file=no)
-
Functions may be annotated with metadata (
:metaexpressions) to be used by the compiler (#8297). -
@inlinebefore a function definition forces the compiler to inline the function (#8297). -
Loads from heap-allocated immutables are hoisted out of loops in more cases (#8867).
-
Accessing fields that are always initialized no longer produces undefined checks (#8827).
-
New generational garbage collector which greatly reduces GC overhead for many common workloads (#5227).
-
Build with USE_GPL_LIBS=0 to exclude all GPL libraries and code (#10870).
-
Linear algebra
-
The
LinAlgmodule is now exported. -
sparse(A)now takes anyAbstractMatrixA as an argument (#10031). -
Factorization API is now type-stable; functions dispatch on
Val{false}orVal{true}instead of a boolean value (#9575). -
Added generic Cholesky factorization, and the Cholesky factorization is now parametrized by the matrix type (#7236).
-
Sparse
cholfactandldltfactfunctions now accept apermkeyword for user-provided permutations and ashiftkeyword to factorize a shifted matrix (#10844). -
New
svdsfunction for the sparse truncated SVD (#9425). -
SymmetricandHermitianimmutables are now parametrized by the matrix type (#7992). -
New
ordschurandordschur!functions for sorting a Schur factorization by the eigenvalues (#8467,#9701). -
Givenstype doesn't have a size anymore and is no longer a subtype ofAbstractMatrix(#8660). -
Large speedup in sparse
\and splitting of Cholesky and LDLᵀ factorizations intocholfactandldltfact(#10117). -
Add sparse least squares to
\by addingqrfactfor sparse matrices based on the SPQR library (#10180). -
Split
Triangulartype intoUpperTriangular,LowerTriangular,UnitUpperTriagularandUnitLowerTriangular(#9779) -
OpenBLAS 64-bit (ILP64) interface is now compiled with a
64_suffix (#8734) to avoid conflicts with external libraries using a 32-bit BLAS (#4923). -
New
vecdotfunction, analogous tovecnorm, for Euclidean inner products over any iterable container (#11067). -
p = plan_fft(x)and similar functions now return aBase.DFT.Planobject, rather than an anonymous function. Calling it viap(x)is deprecated in favor ofp * xorp \ x(for the inverse), and it can also be used withA_mul_B!to employ pre-allocated output arrays (#12087). -
LU{T,Tridiagonal{T}}now supports extraction ofL,U,p, andPfactors (#12137). -
Allocations in sparse matrix factorizations are now tracked by Julia's garbage collector (#12034).
-
-
Strings
-
NUL-terminated strings should now be passed to C via the new
Cstringtype, notPtr{UInt8}orPtr{Cchar}, in order to check whether the string is free of NUL characters (which would cause silent truncation in C). The analogous typeCwstringshould be used for NUL-terminatedwchar_t*strings (#10994). -
graphemes(s)returns an iterator over grapheme substrings ofs(#9261). -
Character predicates such as
islower(),isspace(), etc. use utf8proc to provide uniform cross-platform behavior and up-to-date, locale-independent support for Unicode standards (#5939). -
reverseindfunction to convert indices in reversed strings (e.g. from reversed regex searches) to indices in the original string (#9249). -
charwidth(c)andstrwidth(s)now return up-to-date cross-platform results (via utf8proc) (#10659): Julia now likes pizza (#3721), but some terminals still don't. -
is_valid_char(c), (nowisvalid(Char,c)(#11241)), now correctly handles Unicode "non-characters", which are valid Unicode codepoints (#11171). -
Backreferences in replacement strings in calls to
replacewith aRegexpattern are now supported (#11849). Use thesstring prefix to indicate a replacement string contains a backreference. For example,replace("ab", r"(.)(.)", s"\2\1")yields "ba". -
Capture groups in regular expressions can now be named using PCRE syntax,
(?P<group_name>...). Capture group matches can be accessed by name by indexing aMatchobject with the name of the group (#11566). -
countlines()now counts all lines, not just non-empty (#11947).
-
-
Array and AbstractArray improvements
-
New multidimensional iterators and index types for efficient iteration over
AbstractArrays. Array iteration should generally be written asfor i in eachindex(A) ... endrather thanfor i = 1:length(A) ... end(#8432). -
New implementation of SubArrays with substantial performance and functionality improvements (#8501).
-
AbstractArray subtypes only need to implement
sizeandgetindexfor scalar indices to support indexing; all other indexing behaviors (including logical indexing, ranges of indices, vectors, colons, etc.) are implemented in default fallbacks. Similarly, they only need to implement scalarsetindex!to support all forms of indexed assingment (#10525). -
AbstractArrays that do not extend
similarnow return anArrayby default (#10525).
-
-
Data structures
-
New
sortperm!function for pre-allocated index arrays (#8792). -
Switch from
O(N)toO(log N)algorithm fordequeue!(pq, key)withPriorityQueue. This provides major speedups for large queues (#8011). -
PriorityQueuenow includes the order type among its parameters,PriorityQueue{KeyType,ValueType,OrderType}. An empty queue can be constructed aspq = PriorityQueue(KeyType,ValueType), if you intend to use the defaultForwardorder, orpq = PriorityQueue(KeyType, ValueType, OrderType)otherwise (#8011). -
Efficient
meanandmedianfor ranges (#8089). -
deepcopyrecurses through immutable types and makes copies of their mutable fields (#8560). -
copy(a::DArray)will now make a copy of aDArray(#9745).
-
-
New types
-
Enums are now supported through the
@enum EnumName EnumValue1 EnumValue2syntax. Enum member values also support abitrary value assignment by the@enum EnumName EnumValue1=1 EnumValue2=10 EnumValue3=20syntax (#10168). -
New
Datesmodule for calendar dates and other time-interval calculations (#7654). -
New
Nullabletype for missing data (#8152). -
A new
Val{T}type allows one to dispatch on bits-type values (#9452). -
linspacenow returns aLinSpaceobject which lazily computes linear interpolation of values between the start and stop values. It "lifts" endpoints which are approximately rational in the same manner as thecolonoperator.
-
-
Arithmetic
-
convertnow checks for overflow when truncating integers or converting between signed and unsigned (#5413). -
Arithmetic is type-preserving for more types; e.g.
(x::Int8) + (y::Int8)now yields anInt8(#3759). -
Reductions (e.g.
reduce,sum) widen small types (integers smaller thanInt, andFloat16). -
Added optional rounding argument to floating-point constructors (#8845).
-
Equality (
==) and inequality (</<=) comparisons are now correct across all numeric types (#9133, #9198). -
Rational arithmetic throws errors on overflow (#8672).
-
Optional
logandlog1pfunctions implemented in pure Julia (experimental) (#10008). -
The
MathConsttype has been renamedIrrational(#11922). -
isapproxnow has simpler and more sensible default tolerances (#12393), supports arrays, and has synonyms≈(U+2248, LaTeX\approx) and≉(U+2249, LaTeX\napprox) forisapproxand!isapprox, respectively (#12472).
-
-
Numbers
-
Random numbers
-
Streamlined random number generation APIs #8246. The default
randno longer uses global state in the underlying C library, dSFMT, making it closer to being thread-safe (#8399, #8832). All APIs can now take anAbstractRNGargument (#8854, #9065). The seed argument tosrandis now optional (#8320, #8854). The APIs accepting a range argument are extended to accept an arbitraryAbstractArray(#9049). Passing a range ofBigInttorandorrand!is now supported (#9122). There are speed improvements across the board (#8808, #8941, #8958, #9083). -
The
randexpandrandexp!functions are exported (#9144).
-
-
File
-
Added function
readlinkwhich returns the value of a symbolic link "path" (#10714). -
Added function
ismountwhich checks if a directory is a mount point (#11279). -
The
cpfunction now accepts keyword argumentsremove_destinationandfollow_symlinks(#10888). -
The
mvfunction now accepts keyword argumentremove_destination(#11145).
-
-
Pipe()creates a bidirectional I/O object that can be passed tospawnorpipelinefor redirecting process streams (#12739). -
Other improvements
-
You can now tab-complete emoji via their short names, using
\:name:<tab>(#10709). -
gc_enablesubsumesgc_disable, and also returns the previous GC state. -
assert,@assertnow throws anAssertionErrorexception type (#9734). -
@simdnow rejects invalid control flow (@goto/ break / continue) in the inner loop body at compile time (#8624). -
The
machinefilenow supports a host count (#7616). -
code_nativenow outputs branch labels (#8897). -
Added
recvfromto get source address of UDP packets (#9418). -
ClusterManagerperformance improvements (#9309) and support for changing transports(#9434). -
Added
Base.get_process_title/Base.set_process_title(#9957). -
readavailablenow returns a byte vector instead of a string. -
New
lockandunlockfunctions, operating onReentrantLock, to lock a stream during concurrent writes from multiple tasks (#10679). -
code_llvmnow outputs stripped IR without debug info or other attached metadata. Usecode_llvm_rawfor the unstripped output (#10747). -
New
withenv(var=>val, ...) do ... endfunction to temporarily modify environment variables (#10914). -
New function
relpathreturns a relative filepath to path either from the current directory or from an optional start directory (#10893). -
mktempandmktempdirnow take an optional argument to set which directory the temporary file or directory is created in. -
New garbage collector tracked memory allocator functions:
jl_malloc,jl_calloc,jl_realloc, andjl_freewith libc API ([#12034]). -
mktempdirandmktempnow have variants that take a function as its first argument for automated clean-up ([#9017]).
-
-
several syntax whitespace insensitivities have been deprecated (#11891).
# function call f (x) # getindex x [17] rand(2) [1] # function definition f (x) = x^2 function foo (x) x^2 end
-
indexing with
Reals that are not subtypes ofInteger(Rational,AbstractFloat, etc.) has been deprecated (#10458). -
push!(A)has been deprecated, useappend!instead of splatting arguments topush!(#10400). -
namesfor composite datatypes has been deprecated and renamed tofieldnames(#10332). -
DArrayfunctionality has been removed fromBaseand is now a standalone package under the JuliaParallel umbrella organization (#10333). -
The
Graphicsmodule has been removed fromBaseand is now a standalone package (#10150, #9862). -
The
Woodburyspecial matrix type has been removed fromLinAlg(#10024). -
medianandmedian!no longer accept achecknankeyword argument (#8605). -
infandnanare now deprecated in favor ofT(Inf)andT(NaN), respectively (#8776). -
oftype(T::Type, x)is deprecated in favor ofconvert(T,x)(orT(x)). -
{...}syntax is deprecated in favor ofAny[...](#8578). -
itrunc,ifloor,iceilandiroundare deprecated in favour oftrunc{T<:Integer}(T,x),floor{T<:Integer}(T,x), etc..truncis now always bound-checked;Base.unsafe_truncprovides the old uncheckeditruncbehaviour (#9133). -
squeezenow requires that passed dimension(s) are anIntor tuple ofInts; callingsqueezewith an arbitrary iterator is deprecated (#9271). Additionally, passed dimensions must be unique and correspond to extant dimensions of the input array. -
randboolis deprecated. Userand(Bool)to produce a random boolean value, andbitrandto produce a random BitArray (#9105, #9569). -
beginswithis renamed tostartswith(#9578). -
nullis renamed tonullspace(#9714). -
The operators
|>,.>,>>, and.>>as used for process I/O redirection are replaced with thepipelinefunction (#5349, #12739). -
flipud(A)andfliplr(A)have been deprecated in favor offlipdim(A, 1)andflipdim(A, 2), respectively (#10446). -
Numeric conversion functions whose names are lower-case versions of type names have been removed. To convert a scalar, use the type name, e.g.
Int32(x). To convert an array to a different element type, useArray{T}(x),map(T,x), orround(T,x). To parse a string as an integer or floating-point number, useparse(#1470, #6211). -
Low-level functions from the C library and dynamic linker have been moved to modules
LibcandLibdl, respectively (#10328). -
The functions
parseint,parsefloat,float32_isvalid,float64_isvalid, and the string-argumentBigIntandBigFloathave been replaced byparseandtryparsewith a type argument. The string macrobig"xx"can be used to constructBigIntandBigFloatliterals (#3631, #5704, #9487, #10543, #10955). -
the
--int-literalscompiler option is no longer accepted (#9597). -
Instead of
linrange, uselinspace(#9666). -
The functions
is_valid_char,is_valid_ascii,is_valid_utf8,is_valid_utf16, andis_valid_utf32have been replaced by genericisvalidmethods. The single argument formisvalid(value)can now be used for values of typeChar,ASCIIString,UTF8String,UTF16StringandUTF32String. The two argument formisvalid(type, value)can be used with the above types, with values of typeVector{UInt8},Vector{UInt16},Vector{UInt32}, andVector{Char}(#11241). -
Instead of
utf32(64,123,...)useutf32(UInt32[64,123,...])(#11379). -
start_timerandstop_timerare replaced byTimerandclose. -
The following internal julia C functions have been renamed, in order to prevent potential naming conflicts with C libraries: (#11741)
-
gc_wb*->jl_gc_wb* -
gc_queue_root->jl_gc_queue_root -
allocobj->jl_gc_allocobj -
alloc_[0-3]w->jl_gc_alloc_*w -
diff_gc_total_bytes->jl_gc_diff_total_bytes -
sync_gc_total_bytes->jl_gc_sync_total_bytes
-
-
require(::AbstractString)andreload(see news about addition ofcompile). -
cartesianmapis deprecated in favor of iterating over aCartesianRange
-
Greatly enhanced performance for passing and returning
Tuples (#4042). -
Tuples (ofIntegers,Symbols, orBools) can now be used as type parameters (#5164). -
An additional default "inner" constructor accepting any arguments is now generated. Constructors that look like
MyType(a, b) = new(a, b)do not need to be added manually (#4026, #7071). -
Expanded array type hierarchy to include an abstract
DenseArrayfor in-memory arrays with standard strided storage (#987, #2345, #6212). -
When reloading code, types whose definitions have not changed can be ignored in some cases.
-
Binary
~now parses as a vararg macro call to@~. For examplex~y~z=>@~ x y z(#4882). -
Structure fields can now be accessed by index (#4806).
-
If a module contains a function
__init__(), it will be called when the module is first loaded, and on process startup if a pre-compiled version of the module is present (#1268). -
--check-bounds=yes|nocompiler option -
Unicode identifiers are normalized (NFC) so that different encodings of equivalent strings are treated as the same identifier (#5462).
-
The set of characters permitted in identifiers has been restricted based on Unicode categories. Generally, punctuation, formatting and control characters, and operator symbols are not allowed in identifiers. Number-like characters cannot begin identifiers (#5936).
-
Define a limited number of infix Unicode operators (#552, #6582):
Precedence class Operators (with synonyms, if any) == ≥ (>=) ≤ (<=) ≡ (===) ≠ (!=) ≢ (!==) .≥ (.>=) .≤ (.<=) .!= (.≠) ∈ ( in) ∉ ((x,y)->!in(x, y)) ∋ ((x,y)->in(y, x)) ∌ ((x,y)->!in(y, x)) ⊆ (issubset) ⊈ ((x,y)->!issubset(x, y)) ⊊ ((x,y)->x⊆y && x!=y)+ ∪ ( union)* ÷ ( div) ⋅ (dot) × (cross) ∩ (intersect)unary √ ∛ In addition to these, many of the Unicode operator symbols are parsed as infix operators and are available for user-defined methods (#6929).
-
Improved reporting of syntax errors (#6179)
-
breakinside aforloop with multiple ranges now exits the entire loop nest (#5154) -
Local goto statements using the
@gotoand@labelmacros (#101).
-
New native-Julia REPL implementation, eliminating many problems stemming from the old GNU Readline-based REPL (#6270).
-
Tab-substitution of LaTeX math symbols (e.g.
\alphabyα) (#6911). This also works in IJulia and in Emacs (#6920). -
workspace()function for obtaining a fresh workspace (#1195).
-
isequalnow compares all numbers by value, ignoring type (#6624). -
Implement limited shared-memory parallelism with
SharedArrays (#5380). -
Well-behaved floating-point ranges (#2333, #5636). Introduced the
FloatRangetype for floating-point ranges with a step, which will give intuitive/correct results for classically problematic ranges like0.1:0.1:0.3,0.0:0.7:2.1or1.0:1/49:27.0. -
New functions
minmaxandextrema(#5275). -
New macros
@edit,@less,@code_typed,@code_lowered,@code_llvmand@code_nativethat all function like@which(#5832). -
consume(p)extended toconsume(p, args...), allowing it to optionally passargs...back to the producer (#4775). -
.juliarc.jlis now loaded for both script and REPL execution (#5076). -
The
Sysmodule now includes convenient functions for working with dynamic library handles;Sys.dllistwill list out all paths currently loaded viadlopen, andSys.dlpathwill lookup a path from a handle -
readdlmtreats multiple whitespace characters as a single delimiter by default (when no delimiter is specified). This is useful for reading fixed-width or messy whitespace-delimited data (#5403). -
The Airy, Bessel, Hankel, and related functions (
airy*,bessel*,hankel*) now detect errors returned by the underlying AMOS library, throwing anAmosExceptionin that case (#4967). -
methodswithnow returns an array ofMethods (#5464) rather than just printing its results. -
errno([code])function to get or set the C library'serrno. -
GitHubmodule for interacting with the GitHub API. -
Package improvements
-
Packages are now installed into
.julia/v0.3by default (or whatever the current Julia version is), so that different versions of Julia can co-exist with incompatible packages. Existing.juliainstallations are unaffected unlessPkg.init()is run to re-create the package directories (#3344, #5737). -
Pkg.submit(pkg[,commit])function to automatically submit a GitHub pull request to the package author.
-
-
Collections improvements
-
Arrayassignment (e.g.x[:] = y) ignores singleton dimensions and allows the last dimension of one side to match all trailing dimensions of the other (#4048, #4383). -
Dict(kv)constructor for any iterator on(key,value)pairs. -
Multi-key
Dicts:D[x,y...]is now a synonym forD[(x,y...)]for associationsD(#4870). -
push!andunshift!can push multiple arguments (#4782). -
writedlmandwritecsvnow accept any iterable collection of iterable rows, in addition toAbstractArrayarguments, and thewritedlmdelimiter can be any printable object (e.g. aString) instead of just aChar. -
isemptynow works for any iterable collection (#5827). -
uniquenow accepts an optionaldimargument for finding unique rows or columns of a matrix or regions of a multidimensional array (#5811).
-
-
Numberimprovements-
The
ImaginaryUnittype no longer exists. Instead,imis of typeComplex{Bool}. Making this work required changing the semantics of boolean multiplication to approximately,true * x = xandfalse * x = zero(x), which can itself be considered useful (#5468). -
bigis now vectorized (#4766) -
nextpowandprevpownow return thea^nvalues instead of the exponentn(#4819) -
Overflow detection in
parseint(#4874). -
randnow supports arbitraryRangesarguments (#5059). -
expm1andlog1pnow support complex arguments (#3141). -
Broadcasting
.//is now included (#7094). -
prevfloatandnextfloatnow saturate at -Inf and Inf, respectively, and have otherwise been fixed to follow the IEEE-754 standard functionsnextDownandnextUp(#5025). -
New function
widenfor widening numeric types and values, andwidemulfor multiplying to a larger type (#6169). -
polygamma,digamma, andtrigammanow accept complex arguments, andzeta(s, z)now provides the Hurwitz zeta (#7125). -
Narrow integer types (< 32 bits) are promoted to
Float64rather than toFloat32byfloat(x)(#7390).
-
-
Stringimprovements-
Triple-quoted regex strings,
r"""..."""(#4934). -
New string type,
UTF16String(#4930), constructed byutf16(s)from another string, aUint16array or pointer, or a byte array (possibly prefixed by a byte-order marker to indicate endian-ness). Its data is internallyNULL-terminated for passing to C (#7016). -
CharStringis renamed toUTF32String(#4943), and its data is now internallyNULL-terminated for passing to C (#7016).CharString(c::Char...)is deprecated in favor ofutf32(c...), andutf32(s)otherwise has functionality similar toutf16(s). -
New
WStringandwstringsynonyms for eitherUTF16Stringandutf16orUTF32Stringandutf32, respectively, depending on the width ofCwchar_t(#7016). -
normalize_stringfunction to perform Unicode normalization, case-folding, and other transformations (#5576). -
pointer(s, i=1)forByteString,UTF16String,UTF32String, andSubStrings thereof (#5703). -
bytestringis automatically called onStringarguments for conversion toPtr{Uint8}inccall(#5677).
-
-
Linear algebra improvements
-
Balancing options for eigenvector calculations for general matrices (#5428).
-
Mutating linear algebra functions no longer promote (#5526).
-
condskeelfor Skeel condition numbers (#5726). -
norm(::Matrix)no longer calculates a vector norm when the first dimension is one (#5545); it always uses the operator (induced) matrix norm. -
New
vecnorm(itr, p=2)function that computes the norm of any iterable collection of numbers as if it were a vector of the same length. This generalizes and replacesnormfro(#6057), andnormis now type-stable (#6056). -
New
UniformScalingmatrix type and identityIconstant (#5810). -
None of the concrete matrix factorization types are exported from
Baseby default anymore. -
Sparse linear algebra
-
1-d sparse
getindexhas been implemented (#7047) -
Faster sparse
getindex(#7131). -
Faster sparse
kron(#4958). -
sparse(A) \ Bnow supports a matrixBof right-hand sides (#5196). -
eigs(A, sigma)now uses shift-and-invert for nonzero shiftssigmaand inverse iteration forwhich="SM". Ifsigma==nothing(the new default), computes ordinary (forward) iterations (#5776). -
sprandis faster, and whether any entry is nonzero is now determined independently with the specified probability (#6726).
-
-
Dense linear algebra for special matrix types
-
Interconversions between the special matrix types
Diagonal,Bidiagonal,SymTridiagonal,Triangular, andTriangular, andMatrixare now allowed for matrices which are representable in both source and destination types (5e3f074b). -
Allow for addition and subtraction over mixed matrix types, automatically promoting the result to the denser matrix type (a448e080, #5927)
-
new algorithms for linear solvers and eigensystems of
Bidiagonalmatrices of generic element types (#5277) -
new algorithms for linear solvers, eigensystems and singular systems of
Diagonalmatrices of generic element types (#5263) -
new algorithms for linear solvers and eigensystems of
Triangularmatrices of generic element types (#5255) -
specialized
invanddetmethods forTridiagonalandSymTridiagonalbased on recurrence relations between principal minors (#5358) -
specialized
transpose,ctranspose,istril,istriumethods forTriangular(#5255) andBidiagonal(#5277) -
new LAPACK wrappers
- condition number estimate
cond(A::Triangular)(#5255)
- condition number estimate
-
parametrize
Triangularon matrix type (#7064) -
Lyapunov / Sylvester solver (#7435)
-
eigvalsforSymmetric,TridiagonalandHermitianmatrices now support additional method signatures: (#3688, #6652, #6678, #7647)eigvals(M, el, eu)finds all eigenvalues in the interval(el, eu]eigvals(M, il:iu)finds theilth through theiuth eigenvalues (in ascending order)
-
-
Dense linear algebra for generic matrix element types
-
-
New function
deleteat!deletes a specified index or indices and returns the updated collection -
The
setenvfunction for external processes now accepts adirkeyword argument for specifying the directory to start the child process in (#4888). -
Constructors for collections (
Set,Dict, etc.) now generally accept a single iterable argument giving the elements of the collection (#4996, #4871) -
Ranges and arrays with the same elements are now unequal. This allows hashing and comparing ranges to be faster (#5778).
-
Broadcasting now works on arbitrary
AbstractArrays(#5387) -
Reduction functions that accept a pre-allocated output array, including
sum!,prod!,maximum!,minimum!,all!,any!(#6197, #5387) -
Faster performance on
fill!andcopy!for array types not supporting efficient linear indexing (#5671, #5387) -
Changes to range types (#5585)
-
Rangeis now the abstract range type, instead ofRanges -
New function
rangefor constructing ranges by length -
Rangeis nowStepRange, andRange1is nowUnitRange. Their constructors accept end points instead of lengths. Both are subtypes of a new abstract typeOrdinalRange. -
Ranges now support
BigIntand general ordinal types. -
Very large ranges (e.g.
0:typemax(Int)) can now be constructed, but some operations (e.g.length) will raise anOverflowError.
-
-
Extended API for
covandcor, which accept keyword argumentsvardim,corrected, andmean(#6273) -
New functions
randsubseqandrandsubseq!to create a random subsequence of an array (#6726) -
New macro
@evalpolyfor efficient inline evaluation of polynomials (#7146). -
The signal filtering function
filtnow accepts an optional initial filter state vector. A new in-place functionfilt!is also exported (#7513). -
Significantly faster
cumsumandcumprod(#7359). -
Implement
findminandfindmaxover specified array dimensions (#6716). -
Support memory-mapping of files with offsets on Windows (#7242).
-
Catch writes to protect memory, such as when trying to modify a mmapped file opened in read-only mode (#3434).
-
New
--code-coverageand--track-allocationstartup features allow one to measure the number of executions or the amount of memory allocated, respectively, at each line of code (#5423,#7464). -
Profile.initnow accepts keyword arguments, and returns the current settings when no arguments are supplied (#7365).
- Dependencies are now verified against stored MD5/SHA512 hashes, to ensure that the correct file has been downloaded and was not modified (#6773).
-
convert(Ptr{T1}, x::Array{T2})is now deprecated unlessT1 == T2orT1 == Void(#6073). (You can still explicitlyconvertone pointer type into another if needed.) -
Sys.shlib_exthas been renamed toSys.dlext -
denseis deprecated in favor offull(#4759). -
The
Stattype is renamedStatStruct(#4670). -
setrounding,roundingandsetroundingnow take an additional argument specifying the floating point type to which they apply. The old behaviour and[get/set/with]_bigfloat_roundingfunctions are deprecated (#5007). -
cholpfactandqrpfactare deprecated in favor of keyword arguments incholfact(..., pivot=true)andqrfact(..., pivot=true)(#5330). -
symmetrize!is deprecated in favor ofBase.LinAlg.copytri!(#5427). -
myindexeshas been renamed tolocalindexes(#5475). -
factorize!is deprecated in favor offactorize(#5526). -
nnzcounts the number of structural nonzeros in a sparse matrix. Usecountnzfor the actual number of nonzeros (#6769). -
setfieldis renamedsetfield!(#5748). -
putandtakeare renamedput!andtake!(#5511). -
put!now returns its first argument, the remote reference (#5819). -
readmethods that modify a passed array are now calledread!(#5970) -
infsandnansare deprecated in favor of the more generalfill. -
*anddivare no longer supported forChar. -
Rangeis renamedStepRangeandRange1is renamedUnitRange.Rangesis renamedRange. -
bitmixis replaced by a 2-argument form ofhash. -
readsfromandwritestoare replaced byopen(#6948). -
insert!now throws aBoundsErrorifindex > length(collection)+1(#7373). -
No longer exported from
Base:start_reading,stop_reading,start_watching(#10885).
The 0.2 release brings improvements to many areas of Julia. Among the most visible changes are support for 64-bit Windows, keyword arguments to functions, immutable types, a redesigned and polished package manager, a multimedia interface supporting usage of Julia in IPython, a built-in profiler, and major improvements to Julia's linear algebra, I/O, and parallel capabilities. These are accompanied by many other changes adding new features, enhancing the library's consistency, improving performance, increasing test coverage, easing installation, and expanding the documentation. While not part of Julia proper, the package ecosystem has also grown and matured considerably since the 0.1 release. See below for more information about the long list of changes that improve Julia's usability and performance.
-
Immutable types (#13).
-
Triple-quoted string literals (#70).
-
New infix operator
in(e.g.x in S), and corresponding functionin(x,S), replacingcontains(S,x)function (#2703). -
New variable bindings on each for loop and comprehension iteration (#1571). For example, before this change:
julia> map(f->f(), { ()->i for i=1:3 }) 3-element Any Array: 3 3 3and after:
julia> map(f->f(), { ()->i for i=1:3 }) 3-element Any Array: 1 2 3 -
Explicit relative importing (#2375).
-
Methods can be added to functions in other modules using dot syntax, as in
Foo.bar(x) = 0. -
import module: name1, name2, ...(#5214). -
A semicolon is now allowed after an
importorusingstatement (#4130). -
In an interactive session (REPL), you can use
;cmdto runcmdvia an interactive shell. For example:julia> ;ls CONTRIBUTING.md Makefile VERSION deps/ julia@ ui/ DISTRIBUTING.md NEWS.md Windows.inc doc/ src/ usr/ LICENSE.md README.md base/ etc/ test/ Make.inc README.windows.md contrib/ examples/ tmp/
-
Sampling profiler (#2597).
-
Functions for examining stages of the compiler's output:
code_lowered,code_typed,code_llvm, andcode_native. -
Multimedia I/O API (display, writemime, etcetera) (#3932).
-
MPFR-based
BigFloat(#2814), and many newBigFloatoperations. -
New half-precision IEEE floating-point type,
Float16(#3467). -
Support for setting floating-point rounding modes (#3149).
-
methodswithshows all methods with an argument of specific type. -
mapslicesprovides a general way to perform operations on slices of arrays (#2204). -
repeatfunction for constructing Arrays with repeated elements (#3605). -
Collections.PriorityQueuetype andCollections.heapfunctions (#2920). -
quadgk1d-integration routine (#3140). -
erfinvanderfcinvfunctions (#2987). -
varm,stdm(#2265). -
digamma,invdigamma,trigammaandpolygammafor calculating derivatives ofgammafunction (#3233). -
logdet(#3070). -
Names for C-compatible types:
Cchar,Clong, etc. (#2370). -
cglobalto access global variables (#1815). -
unsafe_pointer_to_objref(#2468) andpointer_from_objref(#2515). -
readandwritefor external processes. -
I/O functions
readbytesandreadbytes!(#3878). -
flush_cstdiofunction (#3949). -
ClusterManager makes it possible to support different types of compute clusters (#3649, #4014).
-
rmprocsfor removing processors from a parallel computing session. The system can also tolerate to some extent processors that die unexpectedly (#3050). -
interruptfor interrupting worker processes (#3819). -
timedwaitdoes a polled wait for an event till a specified timeout. -
Conditiontype withwaitandnotifyfunctions forTasksynchronization. -
versioninfoprovides detailed version information, especially useful when reporting and diagnosing bugs. -
detachfor running child processes in a separate process group. -
setenvfor passing environment variables to child processes. -
ifelseeagerly-evaluated conditional function, especially useful for vectorized conditionals.
-
isequalnow returnsfalsefor numbers of different types. This makes it much easier to define hashing for new numeric types. Uses ofDictwith numeric keys might need to change to account for this increased strictness. -
A redesigned and rewritten
Pkgsystem is much more robust in case of problems. The basic interface to adding and removing package requirements remains the same, but great deal of additional functionality for developing packages in-place was added. See the new packages chapter in the manual for further details. -
Sorting API updates (#3665) – see sorting functions.
-
The
delete!(d::Dict, key)function has been split into separatepop!anddelete!functions (#3439).pop!(d,key)removeskeyfromdand returns the value that was associated with it; it throws an exception ifddoes not containkey.delete!(d,key)removeskeyfromdand succeeds regardless of whetherdcontainedkeyor not, returningditself in either case. -
Linear-algebra factorization routines (
lu,chol, etc.) now returnFactorizationobjects (andlud,chold, etc. are deprecated; #2212). -
A number of improvements to sparse matrix capabilities and sparse linear algebra.
-
More linear algebra fixes and eigensolver hooks for
SymTridiagonal,TridiagonalandBidiagonalmatrix types (#2606, #2608, #2609, #2611, #2678, #2713, #2720, #2725). -
Change
integer_valued,real_valued, and so on toisinteger,isreal, and so on, and semantics of the later are now value-based rather than type-based, unlike MATLAB/Octave (#3071).isboolandiscomplexare eliminated in favor of a generaliseltypefunction. -
Transitive comparison of floats with rationals (#3102).
-
Fast prime generation with
primesand fast primality testing withisprime. -
sumandcumsumnow use pairwise summation for better accuracy (#4039). -
Dot operators (
.+,.*etc.) now broadcast singleton dimensions of array arguments. This behavior can be applied to any function usingbroadcast(f, ...). -
combinations,permutations, andpartitionsnow return iterators instead of a task, andinteger_partitionshas been renamed topartitions(#3989, #4055). -
isreadable/iswritablemethods added for more IO types (#3872). -
Much faster and improved
readdlmandwritedlm(#3350, #3468, #3483). -
Faster
matchall(#3719), and various string and regex improvements. -
Documentation of advanced linear algebra features (#2807).
-
Support optional RTLD flags in
dlopen(#2380). -
pmapnow works with any iterable collection. -
Options in
pmapfor retrying or ignoring failed tasks. -
New
sinpi(x)andcospi(x)functions to compute sine and cosine ofpi*xmore accurately (#4112). -
New implementations of elementary complex functions
sqrt,log,asin,acos,atan,tanh,asinh,acosh,atanhwith correct branch cuts (#2891). -
Improved behavior of
SubArray(#4412, #4284, #4044, #3697, #3790, #3148, #2844, #2644 and various other fixes). -
New convenience functions in graphics API.
-
Improved backtraces on Windows and OS X.
-
Implementation of reduction functions (including
reduce,mapreduce,sum,prod,maximum,minimum,all, andany) are refactored, with improved type stability, efficiency, and consistency (#6116, #7035, #7061, #7106).
-
Methods of
minandmaxthat do reductions were renamed tominimumandmaximum.min(x)is nowminimum(x), andmin(x,(),dim)is nowminimum(x,dim)(#4235). -
ComplexPairwas renamed toComplexand madeimmutable, andComplex128and so on are now aliases to the newComplextype. -
!was added to the name of many mutating functions, e.g.,pushwas renamedpush!(#907). -
refrenamed togetindex, andassigntosetindex!(#1484). -
writeablerenamed towritable(#3874). -
logbandilogbrenamed toexponent(#2516). -
quote_stringbecame a method ofrepr. -
safe_char,check_ascii, andcheck_utf8replaced byis_valid_char,is_valid_ascii, andis_valid_utf8, respectively. -
each_line,each_match,begins_with,ends_with,parse_float,parse_int, andseek_endreplaced by:eachline,eachmatch, and so on (_was removed) (#1539). -
parse_bin(s)replaced byparseint(s,2);parse_oct(s)replaced byparseint(s,8);parse_hex(s)replaced byparseint(s,16). -
findn_nzsreplaced byfindnz(#1539). -
DivideByZeroErrorreplaced byDivideError. -
addprocs_ssh,addprocs_ssh_tunnel, andaddprocs_localreplaced byaddprocs(with keyword options). -
remote_call,remote_call_fetch, andremote_call_waitreplaced byremotecall,remotecall_fetch, andremotecall_wait. -
hasreplaced byinfor sets and byhaskeyfor dictionaries. -
diagmmanddiagmm!replaced byscaleandscale!(#2916). -
unsafe_refandunsafe_assignreplaced byunsafe_loadandunsafe_store!. -
add_each!anddel_each!replaced byunion!andsetdiff!. -
isdenormalrenamed toissubnormal(#3105). -
exprreplaced by direct call toExprconstructor. -
|,&,$,-, and~for sets replaced byunion,intersect,symdiff,setdiff, andcomplement(#3272). -
squarefunction removed. -
pascalfunction removed. -
addandadd!forSetreplaced bypush!. -
lsfunction deprecated in favor ofreaddiror;lsin the REPL. -
start_timernow expects arguments in units of seconds, not milliseconds. -
Shell redirection operators
|,>, and<eliminated in favor of a new operator|>(#3523). -
amapis deprecated in favor of newmapslicesfunctionality. -
The
Reverseiterator was removed since it did not work in many cases. -
The
gcdfunction now returns a non-negative value regardless of the argument signs, and various other sign problems withinvmod,lcm,gcdx, andpowermodwere fixed (#4811).
-
julia-release-*executables renamed tojulia-*, andlibjulia-releaserenamed tolibjulia(#4177). -
Packages will now be installed in
.julia/vX.Y, where X.Y is the current Julia version.
Too numerous to mention.