- Support for Unicode 12.1.0 (#32002).
- Methods can now be added to an abstract type (#31916).
- Support for unicode bold digits and double-struck digits 0 through 9 as valid identifiers (#32838).
- Added the syntax
var"#str#"
for printing and parsing non-standard variable names (#32408).
- New experimental
Threads.@spawn
macro that runs a task on any available thread (#32600). - All system-level I/O operations (e.g. files and sockets) are now thread-safe.
This does not include subtypes of
IO
that are entirely in-memory, such asIOBuffer
, although it specifically does includeBufferStream
. (#32309, #32174, #31981, #32421). - The global random number generator (
GLOBAL_RNG
) is now thread-safe (and thread-local) (#32407). - New
Channel(f::Function, spawn=true)
keyword argument to schedule the created Task on any available thread, matching the behavior ofThreads.@spawn
(#32872). - Simplified the
Channel
constructor, which is now easier to read and more idiomatic julia. Use of the keyword argumentscsize
andctype
is now discouraged (#30855, #32818).
findfirst
,findlast
,findnext
andfindprev
now accept a character as first argument to search for that character in a string passed as the second argument (#31664).- New
findall(pattern, string)
method wherepattern
is a string or regex (#31834). count(pattern, string)
gives the number of thingsfindall
would match (#32849).istaskfailed
is now documented and exported, like its siblingsistaskdone
andistaskstarted
(#32300).RefArray
andRefValue
objects now accept indexCartesianIndex()
ingetindex
andsetindex!
(#32653)- Added
sincosd(x)
to simultaneously compute the sine and cosine ofx
, wherex
is in degrees (#30134). - The function
nonmissingtype
, which removesMissing
from type unions, is now exported (#31562).
Pkg
can now download and install binary artifacts through thePkg.Artifacts
submodule and supporting functions. ([#32918])- When
wait
(or@sync
, orfetch
) is called on a failingTask
, the exception is propagated as aTaskFailedException
wrapping the task. This makes it possible to see the location of the original failure inside the task (as well as the location of thewait
call, as before) (#32814). Regex
can now be multiplied (*
) and exponentiated (^
), like strings (#23422).Cmd
interpolation (`$(x::Cmd) a b c`
where) now propagatesx
's process flags (environment, flags, working directory, etc) ifx
is the first interpolant and errors otherwise (#24353).- Zero-dimensional arrays are now consistently preserved in the return values of mathematical
functions that operate on the array(s) as a whole (and are not explicitly broadcasted across their elements).
Previously, the functions
+
,-
,*
,/
,conj
,real
andimag
returned the unwrapped element when operating over zero-dimensional arrays (#32122). IPAddr
subtypes now behave like scalars when used in broadcasting (#32133).Pair
is now treated as a scalar for broadcasting (#32209).clamp
can now handle missing values (#31066).empty
now accepts aNamedTuple
(#32534).mod
now accepts a unit range as the second argument to easily perform offset modular arithmetic to ensure the result is inside the range (#32628).nothing
can now beprint
ed, and interpolated into strings etc. as the string"nothing"
. It is still not permitted to be interpolated into Cmds (i.e.echo `$(nothing)`
will still error without running anything.) (#32148)- When
open
is called with a function, command, and keyword argument (e.g.open(`ls`, read=true) do f ...
) it now correctly throws aProcessFailedException
like other similar calls (#32193). mktemp
andmktempdir
now try, by default, to remove temporary paths they create before the process exits (#32851).- Added argument
keep
tounescape_string
(#27125).
dlopen()
can now be invoked indo
-block syntax, similar toopen()
.
- The BLAS submodule no longer exports
dot
, which conflicts with that in LinearAlgebra (#31838). diagm
andspdiagm
now accept optionalm,n
initial arguments to specify a size (#31654).Hessenberg
factorizationsH
now support efficient shifted solves(H+µI) \ b
and determinants, and use a specialized tridiagonal factorization for Hermitian matrices. There is also a newUpperHessenberg
matrix type (#31853).- Added keyword argument
alg
tosvd
andsvd!
that allows one to switch between different SVD algorithms (#31057). - Five-argument
mul!(C, A, B, α, β)
now implements inplace multiplication fused with addition C = A B α + C β (#23919).
SparseMatrixCSC(m,n,colptr,rowval,nzval)
perform consistency checks for arguments:colptr
must be properly populated and lengths ofcolptr
,rowval
, andnzval
must be compatible withm
,n
, andeltype(colptr)
.sparse(I, J, V, m, n)
verifies lengths ofI
,J
,V
are equal and compatible witheltype(I)
andm
,n
.
DateTime
andTime
formatting/parsing now supports 12-hour clocks with AM/PM viaI
andp
codes, similar tostrftime
(#32308).- Fixed
repr
such that it displaysTime
as it would be entered in Julia (#32103).
mean
now accepts both a function argument and adims
keyword (#31576).
Sockets.recvfrom
now returns both host and port as an InetAddr (#32729).- Added
InetAddr
constructor fromAbstractString
, representing IP address, andInteger
, representing port number (#31459).
foldr
andmapfoldr
now work on any iterator that supportsIterators.reverse
, not just arrays (#31781).
@spawn expr
from theDistributed
standard library should be replaced with@spawnat :any expr
(#32600).Threads.Mutex
andThreads.RecursiveSpinLock
have been removed; useReentrantLock
(preferred) orThreads.SpinLock
instead (#32875).
- The
ClangSA.jl
static analysis package has been imported, which makes use of the clang static analyzer to validate GC invariants in Julia's C code. The analysis may be run usingmake -C src analyzegc
.
- Argument splatting (
x...
) can now be used in calls to thenew
pseudo-function in constructors (#30577). - Support for Unicode 12.0.0 (#31561).
- Added
⋆
(\star
) as unary operator (#31604).
- Empty entries in
JULIA_DEPOT_PATH
are now expanded to default depot entries (#31009).
- The
Condition
type now has a thread-safe replacement, accessed asThreads.Condition
. With that addition, task scheduling primitives such asReentrantLock
are now thread-safe (#30061). - It is possible to schedule and switch Tasks during
@threads
loops, and perform limited I/O (#31438).
- The build system now prefers downloading prebuilt binary tarballs for most dependencies on
supported systems, disable by setting
USE_BINARYBUILDER=0
atmake
time (#31441).
getipaddrs()
function returns all the IP addresses of the local machine, with IPv4 addresses sorting before IPv6 addresses ([#30349, #30604]).getipaddr(addr_type)
andgetipaddrs(addr_type)
functions returns an IP address(es) of the desired type of the local machine (#30604).- Added
Base.hasproperty
andBase.hasfield
(#28850). - One argument
!=(x)
,>(x)
,>=(x)
,<(x)
,<=(x)
have been added, returning partially-applied versions of the functions, similar to the existing==(x)
andisequal(x)
methods (#30915).
Enum
now behaves like a scalar when used in broadcasting (#30670).- If a
pipeline
is specified withappend=true
set, but no redirection, anArgumentError
is thrown, rather than aErrorException
(#27900). - Functions that invoke commands (e.g.
run(::Cmd)
) now throw aProcessFailedException
rather than anErrorException
, if those commands exit with non-zero exit code (#27900). - The
extrema
function now accepts a function argument in the same manner asminimum
andmaximum
(#30323). hasmethod
can now check for matching keyword argument names (#30712).startswith
andendswith
now accept aRegex
for the second argument (#29790).retry
supports arbitrary callable objects (#30382).- A no-argument constructor for
Ptr{T}
has been added which constructs a null pointer (#30919). strip
now accepts a function argument in the same manner aslstrip
andrstrip
(#31211).mktempdir
now accepts aprefix
keyword argument to customize the file name (#31230, #22922).keytype
andvaltype
now work onAbstractArray
, and return theeltype
ofkeys(...)
andvalues(...)
respectively (#27749).nextfloat(::BigFloat)
andprevfloat(::BigFloat)
now returns a value with the same precision as their argument, which means that (in particular)nextfloat(prevfloat(x)) == x
whereas previously this could result in a completely different value with a different precision (#31310).mapreduce
now accepts multiple iterators, similar tomap
(#31532).filter
now supportsSkipMissing
-wrapped arrays (#31235).- Objects created by calling
skipmissing
on an array can now be indexed using indices from the parent at non-missing positions. This allows functions such asfindall
,findfirst
,argmin
/argmax
andfindmin
/findmax
to work with these objects, returning the index of matching non-missing elements in the parent (#31008). inv(::Missing)
has now been added and returnsmissing
(#31451).nextfloat(::BigFloat, n::Integer)
andprevfloat(::BigFloat, n::Integer)
methods have been added (#31310).
- Added keyword arguments
rtol
,atol
topinv
andnullspace
(#29998). UniformScaling
instances are now callable such that e.g.I(3)
will produce aDiagonal
matrix (#30298).- Eigenvalues λ of general matrices are now sorted lexicographically by (Re λ, Im λ) (#21598).
one
for structured matrices (Diagonal
,Bidiagonal
,Tridiagonal
,Symtridiagonal
) now preserves structure and type (#29777).diagm(v)
is now a shorthand fordiagm(0 => v)
(#31125).
- Performance improvements for sparse matrix-matrix multiplication (#30372).
- Sparse vector outer products are more performant and maintain sparsity in products of the
form
kron(u, v')
,u * v'
, andu .* v'
whereu
andv
are sparse vectors or column views (#24980). - The
sprand
function is now 2 to 5 times faster (#30494). As a consequence of this change, the random stream of matrices produced withsprand
andsprandn
has changed.
getipaddrs
returns IP addresses in the order provided by libuv (#32260).getipaddr
prefers to return the firstIPv4
interface address provided by libuv (#32260).
- Fixed
repr
such that it displaysDateTime
as it would be entered in Julia (#30200).
quantile
now accepts in all cases collections whoseeltype
is not a subtype ofNumber
(#30938).
- Since environment variables on Windows are case-insensitive,
ENV
now converts its keys to uppercase for display, iteration, and copying (#30593).
- libgit2 has been updated to v0.27.7 (#30584).
- OpenBLAS has been updated to v0.3.5 (#30583).
- MbedTLS has been updated to v2.16.0 (#30618).
- libunwind has been updated to v1.3.1 (#30724).
- An exception stack is maintained on each task to make exception handling
more robust and enable root cause analysis. The stack may be accessed using
the experimental function
Base.catch_stack
(#28878). - The experimental macro
Base.@locals
returns a dictionary of current local variable names and values (#29733). - Binary
~
can now be dotted, as inx .~ y
(#30341).
- Parser inputs ending with a comma are now consistently treated as incomplete. Previously they were sometimes parsed as tuples, depending on whitespace (#28506).
- Spaces were accidentally allowed in broadcast call syntax, e.g.
f. (x)
. They are now disallowed, consistent with normal function call syntax (#29781). - Big integer literals and command syntax (backticks) are now parsed with the name of
the macro (
@int128_str
,@uint128_str
,@big_str
,@cmd
) qualified to refer to theCore
module (#29968). - Using the same name for both a local variable and a static parameter is now an error instead of a warning (#29429).
findall(in(b), a)
now returns aCartesianIndex
whena
is a matrix or a higher-dimensional array, for consistency with otherfindall
methods. UseLinearIndices(a)[findall(in(b), a)]
to get the old behavior, orCartesianIndices(a)[findall(in(b), a)]
to get the new behavior on previous Julia versions (#30226).findmin(::BitArray)
andfindmax(::BitArray)
now return aCartesianIndex
whena
is a matrix or a higher-dimensional array, for consistency with other array types. UseLinearIndices(a)[findmin(a)[2]]
to get the old behavior, orCartesianIndices(a)[findmin(a)[2]]
to get the new behavior on previous Julia versions (#30102).- Method signatures such as
f(::Type{T}, ::T) where {T <: X}
andf(::Type{X}, ::Any)
are now considered ambiguous. Previously a bug caused the first one to be considered more specific in some cases (#30160).
- When a script run in interactive mode (
-i
) throws an error, the REPL now starts after the error is displayed. Previously the REPL only started if the script completed without error (#21233).
splitpath(p::String)
function, which is the opposite ofjoinpath(parts...)
: it splits a filepath into its components (#28156).isnothing(::Any)
predicate, to check whether the argument isnothing
. (#29679).getpid(::Process)
method (#24064).eachrow
,eachcol
andeachslice
functions provide efficient iterators over slices of arrays (#29749).fieldtypes(T::Type)
which returns the declared types of the field in type T (#29600).uuid5
has been added to theUUIDs
standard library (#28761).- Predicates
Sys.isfreebsd
,Sys.isopenbsd
,Sys.isnetbsd
, andSys.isdragonfly
for detecting BSD systems have been added (#30249). - Internal
Base.disable_library_threading
that sets libraries to use one thread. It executes function hooks that have been registered withBase.at_disable_library_threading
(#30004).
CartesianIndices
can now be constructed from twoCartesianIndex
esI
andJ
withI:J
(#29440).CartesianIndices
support broadcasting arithmetic (+ and -) with aCartesianIndex
(#29890).copy!
support for arrays, dicts, and sets has been moved to Base from the Future package (#29173).- Channels now convert inserted values (like containers) instead of requiring types to match (#29092).
range
can accept the stop value as a positional argument, e.g.range(1,10,step=2)
(#28708).diff
now supports arrays of arbitrary dimensionality and can operate over any dimension (#29827).- The constructor
BigFloat(::BigFloat)
now respects the global precision setting and always returns aBigFloat
with precision equal toprecision(BigFloat)
(#29127). The optionalprecision
argument to override the global setting is now a keyword instead of positional argument (#29157). - The use of scientific notation when printing
BigFloat
values is now consistent with other floating point types (#29211). Regex
now behaves like a scalar when used in broadcasting (#29913).Char
now behaves like a read-only 0-dimensional array (#29819).parse
now allows strings representing integer 0 and 1 for typeBool
(#29980).Base.tail
now works on named tuples (#29595).- The process id is appended to malloc log files in order to track memory allocations of multiple processes (#29969).
Base.julia_cmd
now propagates the--inline=(yes|no)
flag (#29858).Base.@kwdef
can now be used for parametric structs, and for structs with supertypes (#29316).merge(::NamedTuple, ::NamedTuple...)
can now be used with more than 2NamedTuple
s (#29259).- New
ncodeunits(c::Char)
method as a fast equivalent toncodeunits(string(c))
(#29153). - New
sort!(::AbstractArray; dims)
method that can sort the array along thedims
dimension (#28902). range
now acceptsstop
as a positional argument (#28708).get(A::AbstractArray, (), default)
now returnsA[]
instead of an empty array (#30270).parse(Bool, str)
is now supported (#29997).copyto!(::AbstractMatrix, ::UniformScaling)
now supports rectangular matrices (#28790).current_project()
now searches the parent directories of a Git repository for aProject.toml
file. This also affects the behavior of the--project
command line option when using the default--project=@.
(#29108).- The
spawn
API is now more flexible and supports taking IOBuffer directly as an I/O stream, converting to a system pipe as needed (#30278).
- New
DateTime(::Date, ::Time)
constructor (#29754). TimeZone
now behaves like a scalar when used in broadcasting (#30159).
edit
can now be called on a module to edit the file that defines it (#29636).- All compiler-reflection tools (i.e. the
code_
class of functions and macros) now print accurate line number and inlining information in a common style, and take an optional parameter (debuginfo=:default) to control the verbosity of the metadata shown (#29893).
isdiag
andisposdef
forDiagonal
andUniformScaling
(#29638).mul!
,rmul!
andlmul!
methods forUniformScaling
(#29506).Symmetric
andHermitian
matrices now preserve the wrapper when scaled with a number (#29469).- Exponentiation operator
^
now supports raising anIrrational
to anAbstractMatrix
power (#29782). - Added keyword arguments
rtol
,atol
torank
(#29926).
randperm
andrandcycle
now use the type of their argument to determine the element type of the returned array (#29670).- A new method
rand(::Tuple)
implements sampling from the values of a tuple (#25278). serialize
anddeserialize
now accept a filename argument, likewrite
andread
(#30151).
sprandn
now supports specifying the output element type (#30083).
mean
andvar
now handle more kinds of empty inputs (#29033).
- 7zip (bundled with Julia on Windows) has been upgraded from version 16.04 to 18.05 (#30035).
- Busybox is no longer bundled with Julia on Windows (#30022).
- OpenBLAS has been upgraded from 0.3.2 to 0.3.3 (#29845).
- The source code for Pkg is no longer included in JuliaLang/julia. Pkg is instead downloaded during the build process (#29615).
- LLVM has been upgraded to 6.0.1 and support for LLVM < 6.0 has been dropped (#28745, #28696).
- Pkg has been upgraded to version 1.1 (#30342).
one(i::CartesianIndex)
should be replaced withoneunit(i::CartesianIndex)
(#29442).- The internal array
Base.Grisu.DIGITS
is deprecated; new code should useBase.Grisu.getbuf()
to get an appropriate task-local buffer and pass it togrisu()
instead (#29907). - The internal function
Base._default_type(T)
has been removed. Calls to it should be replaced with just the argumentT
(#29739). peakflops
has been scheduled to move fromInteractiveUtils
toLinearAlgebra
but is already now available asLinearAlgebra.peakflops
(#29978).
Julia v1.0 is identical to the v0.7 release, with the exception that it removes all deprecations and deprecation related warnings. When upgrading a codebase from v0.6, the process is to first get the code to work on v0.7, and fix all the deprecation warnings. Once the code runs on v0.7 without warnings, it should be good to run on v1.0.
Refer to the Release Notes for v0.7 for a detailed list of changes from Julia v0.6.
- The
Libdl
module's methodsdlopen()
anddlsym()
have gained athrow_error
keyword argument, replacing the now-deprecateddlopen_e()
anddlsym_e()
methods. Whenthrow_error
isfalse
, failure to locate a shared library or symbol will returnnothing
rather thanC_NULL
. (#28888)
- The old package manager (now called
OldPkg
) has been moved to a separate repository at https://github.com/JuliaArchive/OldPkg.jl (#27930)
-
Local variables can be tested for being defined using the new
@isdefined variable
macro (#22281). -
Destructuring in function arguments: when an expression such as
(x, y)
is used as a function argument name, the argument is unpacked into local variablesx
andy
as in the assignment(x, y) = arg
(#6614). -
Named tuples, with the syntax
(a=1, b=2)
. These behave very similarly to tuples, except components can also be accessed by name using dot syntaxt.a
(#22194). -
Keyword argument containers (
kw
inf(; kw...)
) are now based on named tuples. Dictionary functions likehaskey
and indexing can be used on them, and name-value pairs can be iterated usingpairs(kw)
.kw
can 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 ...; end
can be used to provide both@generated
and normal implementations of part of a function. Surrounding code will be common to both versions (#23168). -
Added
⟂
(\perp
) operator with comparison precedence (#24404). -
The
missing
singleton 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 SQLsNULL
and R'sNA
. -
Field access via dot-syntax can now be overloaded by adding methods to
Base.getproperty
andBase.setproperty!
(#1974), optionally along with a correspondingBase.propertynames
method for reflection (#25311). -
Values for
Enum
s can now be specified inside of abegin
block when using the@enum
macro (#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)
-
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
convert
is deprecated. Instead, new types should prefer to define constructors, and addconvert
methods that call those constructors only as necessary (#15120). -
The syntax
1.+2
is 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
√2x
parses as(√2) * x
(#27641). -
Declaring arguments as
x::ANY
to 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*3
as1<<(2*3)
is deprecated, and will change to(1<<2)*3
in a future version (#13079). -
The parsing of
<|
is now right associative.|>
remains left associative (#24153). -
:
now parses like other operators, as a call to a function named:
, instead of callingcolon
(#25947). -
{ }
expressions now usebraces
andbracescat
as expression heads instead ofcell1d
andcell2d
, and parse similarly tovect
andvcat
(#8470). -
Nested
if
expressions that arise from the keywordelseif
now useelseif
as their expression head instead ofif
(#21774). -
let
blocks now parse the same asfor
loops; the first argument is either an assignment orblock
of assignments, and the second argument is a block of statements (#21774). -
do
syntax 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
=>struct
-
bitstype
=>primitive
(order of arguments is also reversed, to match syntax) -
composite_type
=>struct_type
-
bits_type
=>primitive_type
-
-
The
global
keyword now only introduces a new binding if one doesn't already exist in the module. This means that assignment to a global (global sin = 3
) may now throw the error: "cannot assign variable Base.sin from module Main", rather than emitting a warning. Additionally, the new bindings are now created before the statement is executed. For example,f() = (global sin = "gluttony"; nothing)
will now resolve which module containssin
eagerly, rather than delaying that decision untilf
is run. (#22984). -
global const
declarations may no longer appear inside functions (#12010). -
Uninitialized
BitArray
constructors 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 throwUndefVarError
when accessing the static parameters (need_to_handle_undef_sparam = Set{Any}(m.sig for m in Test.detect_unbound_args(Base, recursive=true))
) is equal (==
) to some known set (expected = Set()
). (#23117) -
const
declarations on local variables were previously ignored. They now give a warning, so that this syntax can be disallowed or given a new meaning in a future version (#5148). -
Placing an expression after
catch
, as incatch f(x)
, is deprecated. Usecatch; f(x)
instead (#19987). -
In
for i = ...
, if a local variablei
already existed it would be overwritten during the loop. This behavior is deprecated, and in the futurefor
loop variables will always be new variables local to the loop (#22314). The old behavior of overwriting an existing variable is available viafor outer i = ...
. -
In
for i in x
,x
used to be evaluated in a new scope enclosing thefor
loop. Now it is evaluated in the scope outside thefor
loop. -
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 toi
will not be visible on the nextj
loop iteration (#330). -
Variable bindings local to
while
loop bodies are now freshly allocated on each loop iteration, matching the behavior offor
loops. -
Prefix
&
for by-reference arguments toccall
has been deprecated in favor ofRef
argument types (#6080). -
The constructor
Ref(x::T)
now always returns aRef{T}
(#21527). -
All line numbers in ASTs are represented by
LineNumberNode
s; the:line
expression head is no longer used.QuoteNode
s are also consistently used for quoted symbols instead of the:quote
expression head (though:quote
Expr
s are still used for quoted expressions) (#23885). -
The
+
and-
methods forNumber
andUniformScaling
are not ambiguous anymore since+
and-
no longer do automatic broadcasting. Hence, the methods forUniformScaling
andNumber
are no longer deprecated (#23923). -
The keyword
importall
is deprecated. Useusing
and/or individualimport
statements instead (#22789). -
reduce(+, [...])
andreduce(*, [...])
no longer widen the iterated over arguments to system word size.sum
andprod
still preserve this behavior. (#22825) -
Like
_
, variable names consisting only of underscores can be assigned, but accessing their values is deprecated (#24221). -
Raw string literal escaping rules have been changed to make it possible to write all strings. The rule is that backslashes escape both quotes and other backslashes, but only when a sequence of backslashes precedes a quote character. Thus, 2n backslashes followed by a quote encodes n backslashes and the end of the literal while 2n+1 backslashes followed by a quote encodes n backslashes followed by a quote character (#22926).
-
reprmime(mime, x)
has been renamed torepr(mime, x)
, and along withrepr(x)
andsprint
it now accepts an optionalcontext
keyword forIOContext
attributes.stringmime
has 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.B
can now only be used whenA.B
is a module, and the syntaxusing A: B
can 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). -
begin
is 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). -
try
blocks withoutcatch
orfinally
are no longer allowed. An explicit emptycatch
block should be written instead (#27554). -
AbstractArray
types 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]).
This section lists changes that do not have deprecation warnings.
-
The package manager
Pkg
has been replaced with a new one. See the manual entries on "Code Loading" and "Pkg" for documentation. -
replace(s::AbstractString, pat=>repl)
for functionrepl
arguments formerly passed a substring torepl
in all cases. It now passes substrings for string patternspat
, but aChar
for character patterns (whenpat
is aChar
, collection ofChar
, or a character predicate) (#25815). -
readuntil
now does not include the delimiter in its result, matching the behavior ofreadline
. Passkeep=true
to get the old behavior (#25633). -
lu
methods now return decomposition objects such asLU
rather than tuples of arrays or tuples of numbers (#26997, #27159, #27212). -
schur
methods now return decomposition objects such asSchur
andGeneralizedSchur
rather than tuples of arrays (#26997, #27159, #27212). -
lq
methods now return decomposition objects such asLQ
rather than tuples of arrays (#26997, #27159, #27212). -
qr
methods now return decomposition objects such asQR
,QRPivoted
, andQRCompactWY
rather than tuples of arrays (#26997, #27159, #27212). -
svd
methods now return decomposition objects such asSVD
andGeneralizedSVD
rather than tuples of arrays or tuples of numbers (#26997, #27159, #27212). -
countlines
now always counts the last non-empty line even if it does not end with EOL, matching the behavior ofeachline
andreadlines
(#25845). -
getindex(s::String, r::UnitRange{Int})
now throwsStringIndexError
iflast(r)
is not a valid index intos
(#22572). -
ntuple(f, n::Integer)
throwsArgumentError
ifn
is 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 returnsobject
rather thannothing
(#24679). -
The constructor of
SubString
now checks if the requested view range is defined by valid indices in the parentAbstractString
(#22511). -
Macro calls with
for
expressions are now parsed as generators inside function argument lists (#18650). Examples:-
sum(@inbounds a[i] for i = 1:n)
used to give a syntax error, but is now parsed assum(@inbounds(a[i]) for i = 1:n)
. -
sum(@m x for i = 1:n end)
used to parse the argument tosum
as a 2-argument call to macro@m
, but now parses it as a generator plus a syntax error for the danglingend
.
-
-
@__DIR__
returns the current working directory rather thannothing
when not run from a file (#21759). -
@__FILE__
and@__DIR__
return information relative to the file that it was parsed from, rather than from the task-localSOURCE_PATH
global when it was expanded. -
All macros receive an extra argument
__source__::LineNumberNode
which describes the parser location in the source file for the@
of the macro call. It can be accessed as a normal argument variable in the body of the macro. This is implemented by inserting an extra leading argument into theExpr(:macrocall, :@name, LineNumberNode(...), args...)
surface syntax. (#21746) -
Passing the same keyword argument multiple times is now a syntax error (#16937).
-
getsockname
on aTCPSocket
now returns the locally bound address and port of the socket. Previously the address of the remote endpoint was being returned (#21825). -
The
~/.juliarc.jl
file has been moved to~/.julia/config/startup.jl
and/etc/julia/juliarc.jl
file has been renamed to/etc/julia/startup.jl
(#26161). -
Using
ARGS
withinstartup.jl
files or within a .jl file loaded with--load
will no longer contain the script name as the first argument. Instead, the script name will be assigned toPROGRAM_FILE
. (#22092) -
The format for a
ClusterManager
specifying the cookie on the command line is now--worker=<cookie>
.--worker <cookie>
will not work as it is now an optional argument. -
The representation of
CartesianRange
has changed to a tuple-of-AbstractUnitRanges; thestart
andstop
fields are no longer present. Usefirst(R)
andlast(R)
to obtain start/stop. (#20974) -
The
Diagonal
,Bidiagonal
,Tridiagonal
andSymTridiagonal
type definitions have changed fromDiagonal{T}
,Bidiagonal{T}
,Tridiagonal{T}
andSymTridiagonal{T}
toDiagonal{T,V<:AbstractVector{T}}
,Bidiagonal{T,V<:AbstractVector{T}}
,Tridiagonal{T,V<:AbstractVector{T}}
andSymTridiagonal{T,V<:AbstractVector{T}}
respectively (#22718, #22925, #23035, #23154). -
The immediate supertype of
BitArray
is now simplyAbstractArray
.BitArray
is no longer considered a subtype ofDenseArray
andStridedArray
(#25858). -
When called with an argument that contains
NaN
elements,findmin
andfindmax
now return the firstNaN
found and its corresponding index. Previously,NaN
elements were ignored. The new behavior matches that ofmin
,max
,minimum
, andmaximum
. -
isapprox(x,y)
now testsnorm(x-y) <= max(atol, rtol*max(norm(x), norm(y)))
rather thannorm(x-y) <= atol + ...
, andrtol
defaults to zero if anatol > 0
is specified (#22742). -
Spaces are no longer allowed between
@
and the name of a macro in a macro call (#22868). -
Juxtaposition of a non-literal with a macro call (
x@macro
) is no longer valid syntax (#22868). -
On a cluster, all files are now loaded from the local file system rather than node 1 (#22588). To load the same file everywhere from node 1, one possible alternative is to broadcast a call to
include_string
:@everywhere include_string(Main, $(read("filename", String)), "filename")
. Improving upon this API is left as an opportunity for packages. -
randperm(n)
andrandcycle(n)
now always return aVector{Int}
(independent of the type ofn
). Use the corresponding mutating functionsrandperm!
andrandcycle!
to control the array type (#22723). -
Hermitian now ignores any imaginary components in the diagonal instead of checking the diagonal. (#17367)
-
Worker-worker connections are setup lazily for an
:all_to_all
topology. Use keyword arglazy=false
to force all connections to be setup during aaddprocs
call. (#22814) -
In
joinpath(a, b)
on Windows, if the drive specifications ofa
andb
do not match,joinpath
now returnsb
instead of throwing anArgumentError
.joinpath(path...)
is defined to be left associative, so if any argument has a drive path which does not match the drive of the join of the preceding paths, the prior ones are dropped. (#20912) -
^(A::AbstractMatrix{<:Integer}, p::Integer)
now throws aDomainError
ifp < 0
, unlessA == one(A)
orA == -one(A)
(same as for^(A::Integer, p::Integer)
) (#23366). -
^(A::AbstractMatrix{<:Integer}, p::Integer)
now promotes the element type in the same way as^(A::Integer, p::Integer)
. This means, for instance, that[1 1; 0 1]^big(1)
will return aMatrix{BigInt}
instead of aMatrix{Int}
(#23366). -
The element type of the input is now preserved in
unique
. Previously the element type of the output was shrunk to fit the union of the type of each element in the input. (#22696) -
The
promote
function now raises an error if its arguments are of different types and if attempting to convert them to a common type fails to change any of their types. This avoids stack overflows in the common case of definitions likef(x, y) = f(promote(x, y)...)
(#22801). -
indmin
andindmax
have been renamed toargmin
andargmax
, respectively (#25654). -
findmin
,findmax
,argmin
, andargmax
used to always return linear indices. They now returnCartesianIndex
es for all but 1-d arrays, and in general return thekeys
of indexed collections (e.g. dictionaries) (#22907). -
The
openspecfun
library is no longer built and shipped with Julia, as it is no longer used internally (#22390). -
All loaded 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 Package
orimport 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-L
will be executed in the order given on the command line (#23665). -
I
now yieldsUniformScaling{Bool}(true)
rather thanUniformScaling{Int64}(1)
to better preserve types in operations involvingI
(#24396). -
The return type of
reinterpret
has changed toReinterpretArray
.reinterpret
on sparse arrays has been discontinued. -
Base.find_in_path
is nowBase.find_package
orBase.find_source_file
(#24320). -
finalizer
now takes functions or pointers as its first argument, and the object being finalized as its second (rather than the reverse). For the majority of use cases deprecation warnings will be triggered. However, deprecation warnings will not trigger where (1) the callable argument is not a subtype ofFunction
; or (2) both arguments areFunction
s orPtr{Cvoid}
s (#24605). -
The
kill
function now throws errors on user error (e.g. on permission errors), but returns successfully if the process had previously exited. Its return value has been removed. Use theprocess_running
function to determine if a process has already exited. -
The logging system has been redesigned -
info
andwarn
are deprecated and replaced with the logging macros@info
,@warn
,@debug
and@error
. Thelogging
function is also deprecated and replaced withAbstractLogger
and the functions from the new standardLogging
library. (#24490) -
The
RevString
type has been removed from the language;reverse(::String)
returns aString
with code points (or fragments thereof) in reverse order. In general,reverse(s)
should return a string of the same type and encoding ass
with code points in reverse order; any string type overridesreverse
to return a different type of string must also overridereverseind
to 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. -
AbstractRange
objects are now considered as equal to otherAbstractArray
objects by==
andisequal
if 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.RangeStepStyle
trait; see its documentation for details. Types which support subtraction (operator-
) must now implementwiden
for 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
Broadcasted
object 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 specializecopy
andcopyto!
methods rather thanbroadcast
andbroadcast!
. This also allows for more customization and control of fused broadcasts. See the Interfaces chapter for more information. -
find
has been renamed tofindall
.findall
,findfirst
,findlast
,findnext
now take and/or return the same type of indices askeys
/pairs
forAbstractArray
,AbstractDict
,AbstractString
,Tuple
andNamedTuple
objects (#24774, #25545). In particular, this means that they useCartesianIndex
objects 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 returnnothing
when no match is found rather than0
or0:-1
(#25472, #25662, #26149) -
The
Base.HasShape
iterator trait has gained a type parameterN
indicating the number of dimensions, which must correspond to the length of the tuple returned bysize
(#25655). -
AbstractSet
objects are now considered equal by==
andisequal
if all of their elements are equal (#25368). This has required changing the hashing algorithm forBitSet
. -
the default behavior of
titlecase
is changed in two ways (#23393):- characters not starting a word are converted to lowercase;
a new keyword argument
strict
is 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
-
writedlm
in the standard library module DelimitedFiles now writes numeric values usingprint
rather thanprint_shortest
(#25745). -
The
tempname
function used to create a file on Windows but not on other platforms. It now never creates a file (#9053). -
The
fieldnames
andpropertynames
functions now return a tuple rather than an array (#25725). -
indexin
now 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). -
isequal
forPtr
s now compares element types;==
still compares only addresses (#26858). -
widen
on 8- and 16-bit integer types now widens to 16- and 32-bit types, respectively. (#28045). -
mv
,cp
,touch
,mkdir
,mkpath
,chmod
andchown
now return the path that was created/modified rather thannothing
(#27071). -
Regular expressions now default to UCP mode. Escape sequences such as
\w
will now match based on unicode character properties, e.g.r"\w+"
will matchcafé
(not justcaf
). Add thea
modifier (e.g.r"\w+"a
) to restore the previous behavior (#27189). -
@sync
now waits only for lexically enclosed (i.e. visible directly in the source text of its argument)@async
expressions. If you need to wait for a task created by a called functionf
, havef
return the task and put@async wait(f(...))
within the@sync
block. This change makes@schedule
redundant with@async
, so@schedule
has been deprecated (#27164). -
norm(A::AbstractMatrix, p=2)
computes no longer the operator/matrix norm but thenorm
ofA
as 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 tovecdot
before (#27401). -
Sys.CPU_CORES
has 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_CORES
is deprecated in favor ofJULIA_CPU_THREADS
(#27856). -
WeakKeyDict
does not convert keys on insertion anymore (#24941).
-
The function
thisind(s::AbstractString, i::Integer)
returns the largest valid index less or equal thani
in the strings
or0
if no such index exists (#24414). -
Support for Unicode 11 (#28266).
-
Char
is 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]). -
bytes2hex
now accepts an optionalio
argument to output to a hexadecimal stream without allocating aString
first (#27121). -
String(array)
now accepts an arbitraryAbstractVector{UInt8}
. ForVector
inputs, it "steals" the memory buffer, leaving them with an empty buffer which is guaranteed not to be shared with theString
object. For other types of vectors (in particular immutable vectors), a copy is made and the input is not truncated (#26093). -
Irrational
is now a subtype ofAbstractIrrational
(#24245). -
Introduced the
empty
function, 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\bbA
rather than\BbbA
(#25980). -
The function
chop
now accepts two argumentshead
andtail
allowing to specify number of characters to remove from the head and tail of the string (#24126). -
get(io, :color, false)
can now be used to query whether a streamio
supports ANSI color codes (#25067), rather than using the undocumentedBase.have_color
global flag. -
print_with_color
has been deprecated in favor ofprintstyled([io], xs...; bold=false, color=:normal)
for printing styled text (#25522). -
Functions
first
andlast
now acceptnchar
argument forAbstractString
. If this argument is used they return a string consisting of first/lastnchar
characters from the original string (#23960). -
Expressions
x^-n
wheren
is an integer literal now correspond toinv(x)^n
. For example,x^-1
is now essentially a synonym forinv(x)
, and works in a type-stable way even iftypeof(x) != typeof(inv(x))
(#24240). -
New
Iterators.reverse(itr)
for reverse-order iteration (#24187). Iterator typesT
can implementstart
etc. forIterators.Reverse{T}
to support this. -
The functions
nextind
andprevind
now acceptnchar
argument that indicates the number of characters to move (#23805). -
The functions
strip
,lstrip
andrstrip
now returnSubString
(#22496). -
The functions
strwidth
andcharwidth
have been merged intotextwidth
(#20816). -
The functions
base
anddigits
digits now accept a negative base (likendigits
did) (#21692). -
The function
randn
now accepts complex arguments (Complex{T <: AbstractFloat}
) (#21973). -
parse(Complex{T}, string)
can parse complex numbers in some common formats (#24713). -
The function
rand
can 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
randstring
function (#22222). -
Allow multidimensional arrays in
shuffle
andshuffle!
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). -
getpeername
on aTCPSocket
returns the address and port of the remote endpoint of the TCP connection (#21825). -
resize!
andsizehint!
methods no longer over-reserve memory when the requested array size is more than double of its current size (#22038). -
The
crc32c
function for CRC-32c checksums is now exported (#22274). -
eye(::Type{Diagonal{T}}, m::Integer)
has been deprecated in favor ofDiagonal{T}(I, m)
(#24415). -
The output of
versioninfo
is now controlled with keyword arguments (#21974). -
The function
LibGit2.set_remote_url
now always sets both the fetch and push URLs for a git repo. Additionally, the argument order was changed to be consistent with the git command line tool (#22062). -
Added
unique!
which is an inplace version ofunique
(#20549). -
@test isequal(x, y)
and@test isapprox(x, y)
now prints an evaluated expression when the test fails (#22296). -
Uses of
Val{c}
inBase
has been replaced withVal{c}()
, which is now easily accessible via the 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
,cat
andcat_t
. -
A new
@macroexpand1
macro for non recursive macro expansion (#21662). -
Char
s can now be concatenated withString
s and/or otherChar
s using*
(#22532). -
Diagonal
,Bidiagonal
,Tridiagonal
andSymTridiagonal
are now parameterized on the type of the wrapped vectors, allowingDiagonal
,Bidiagonal
,Tridiagonal
andSymTridiagonal
matrices with arbitraryAbstractVector
s (#22718, #22925, #23035, #23154). -
Mutating versions of
randperm
andrandcycle
have been added:randperm!
andrandcycle!
(#22723). -
BigFloat
random numbers can now be generated (#22720). -
The efficiency of random generation for MersenneTwister RNGs has been improved for integers,
Float64
and 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-_
-
diagm
now accepts several diagonal index/vectorPair
s (#24047). -
isequal
,==
, andin
have one argument "curried" forms. For exampleisequal(x)
returns a function that compares its argument tox
usingisequal
(#26436). -
reinterpret
now works on any AbstractArray using the newReinterpretArray
type. This supersedes the old behavior of reinterpret on Arrays. As a result, reinterpreting arrays with different alignment requirements (removed in 0.6) is once again allowed (#23750). -
The
keys
of anAssociative
are 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 directncodeunits
methods. -
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 onncodeunits
however, 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 replaceold
bynew
in collectionA
. There is also another method with a different API, and a mutating variant,replace!
(#22324, #25697, #26206, #27944). -
Adding integers to
CartesianIndex
objects is now deprecated. Instead ofi::Int + x::CartesianIndex
, usei*one(x) + x
(#26284). -
CartesianRange
changes (#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
,setdiff
are 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 ofintersect
andsymdiff
is changed for vectors:intersect
doesn't preserve the multiplicity anymore (usefilter
for the old behavior)symdiff
has been made consistent with the corresponding methods for other containers, by taking the multiplicity of the arguments into account. Useunique
to get the old behavior.
-
The
linearindices
function has been deprecated in favor of the newLinearIndices
type, 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 otherAbstractDict
subtypes and its constructors mirror the ones ofDict
. (#25210) -
IOBuffer
can take thesizehint
keyword argument to suggest a capacity of the buffer (#25944). -
lstrip
andrstrip
now accept a predicate function that defaults toisspace
(#27309). -
trunc
,floor
,ceil
, andround
specifydigits
,sigdigits
andbase
using keyword arguments. (#26156, #26670) -
Sys.which()
provides a cross-platform method to find executable files, similar to the Unixwhich
command. (#26559) -
Added an optimized method of
vecdot
for taking the Frobenius inner product of sparse matrices. (#27470) -
Added an optimized method of
kron
for taking the tensor product of twoDiagonal
matrices. ([27581]) -
An official API for extending
rand
is now defined (#23964, #25002). -
The constructor
MersenneTwister()
is re-enabled, producing a randomly initialized RNG (similar toRandom.seed!(MersenneTwister(0))
) (#21909). -
BitSet
can now store anyInt
(instead of only positive ones) (#25029). -
The initial element
v0
inreduce(op, v0, itr)
has been replaced with aninit
optional keyword argument, as inreduce(op, itr; init=v0)
. Similarly forfoldl
,foldr
,mapreduce
,mapfoldl
,mapfoldr
,accumulate
andaccumulate!
. (#27711, #27859)
-
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.
-
The
JULIA_HOME
environment variable has been renamed toJULIA_BINDIR
andBase.JULIA_HOME
has been moved toSys.BINDIR
(#20899). -
The keyword
immutable
is fully deprecated tostruct
, andtype
is fully deprecated tomutable struct
(#19157, #20418). -
lufact
,schurfact
,lqfact
,qrfact
,ldltfact
,svdfact
,bkfact
,hessfact
,eigfact
, andcholfact
have 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 anEigen
object. 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 anEigen
object (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 aGeneralizedEigen
object. 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 aGeneralizedEigen
object (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
dims
keyword 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). -
EnvHash
has been renamed toEnvDict
(#24167). -
Uninitialized
Array
constructors 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 ofx
on the right hand side. Ifx
is anAbstractArray
, its contents are copied elementwise into the locations inA
selected byI
and it must have the same number of elements asI
selects locations. Otherwise, ifx
is not anAbstractArray
, then its value is implicitly broadcast to all locations to all locations inA
selected 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...] .= x
orfill!(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). -
eye
has been deprecated in favor ofI
andMatrix
constructors. Please see the deprecation warnings for replacement details (#24438). -
zeros(D::Diagonal[, opts...])
has been deprecated (#24654). -
Using Bool values directly as indices is now deprecated and will be an error in the future. Convert them to
Int
before indexing if you intend to access index1
fortrue
and0
forfalse
. -
slicedim(A, d, i)
has been deprecated in favor ofcopy(selectdim(A, d, i))
. The newselectdim
function now always returns a view intoA
; in many cases thecopy
is not necessary. Previously,slicedim
on a vectorV
over dimensiond=1
and scalar indexi
would return the just selected element (unlessV
was aBitVector
). This has now been made consistent:selectdim
now always returns a view into the original array, with a zero-dimensional view in this specific case (#26009). -
whos
has been renamedvarinfo
, and now returns a markdown table instead of printing output (#12131). -
Uninitialized
RowVector
constructors of the formRowVector{T}(shape...)
have been deprecated in favor of equivalents 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 anuplo
symbol have been deprecated in favor of usingHermitian
(orSymmetric
) views (#22187, #22188). -
The
thin
keyword argument for orthogonal decomposition methods has been deprecated in favor offull
, which has the opposite meaning:thin == true
if and only iffull == false
(#24279). -
isposdef(A::AbstractMatrix, UL::Symbol)
andisposdef!(A::AbstractMatrix, UL::Symbol)
have been deprecated in favor ofisposdef(Hermitian(A, UL))
andisposdef!(Hermitian(A, UL))
respectively (#22245). -
The
bkfact
/bkfact!
methods that accepteduplo
andissymmetric
symbols have been deprecated in favor of usingHermitian
(orSymmetric
) views (#22605). -
The function
current_module
is deprecated and replaced with@__MODULE__
. This caused the deprecation of some reflection methods (such asmacroexpand
andisconst
), which now require a module argument. And it caused the bugfix of other default arguments to use the Main module (includingwhos
,which
) (#22064). -
expand(ex)
andexpand(module, ex)
have been deprecated in favor ofMeta.lower(module, ex)
(#22064, #24278). -
ones(A::AbstractArray[, opts...])
andzeros(A::AbstractArray[, opts...])
methods have been deprecated. Forzeros(A)
, considerzero(A)
. Forones(A)
orzeros(A)
, considerones(size(A))
,zeros(size(A))
,fill(v, size(A))
forv
an 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 functionf
that 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 functionf
directly (#26733). -
The functions
ones
andzeros
used to accept any objects as dimensional arguments, implicitly converting them toInt
s. This is now deprecated; onlyInteger
s orAbstractUnitRange
s are accepted as arguments. Instead, convert the arguments before callingones
orzeros
(#26733). -
The variadic
size(A, dim1, dim2, dims...)
method to return a tuple of multiple dimension lengths ofA
has been deprecated (#26862). -
The
Operators
module is deprecated. Instead, import required operators explicitly fromBase
, e.g.import Base: +, -, *, /
(#22251). -
Bindings to the FFTW library have been removed from Base. The DFT framework for building FFT implementations is now in AbstractFFTs.jl, the bindings to the FFTW library are in FFTW.jl, and the Base signal processing functions which used FFTs are now in DSP.jl (#21956).
-
The
corrected
positional argument tocov
has been deprecated in favor of a keyword argument with the same name (#21709). -
Omitting spaces around the
?
and the:
tokens in a ternary expression has been deprecated. Ternaries must now include some amount of whitespace, e.g.x ? a : b
rather thanx?a:b
(#22523 and #22712). -
?
can no longer be used as an identifier name (#22712) -
The method
replace(s::AbstractString, pat, r, [count])
is deprecated in favor ofreplace(s::AbstractString, pat => r; [count])
(#25165). Moreover,count
cannot 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 itsRef
argument (#21592). -
nb_available
is nowbytesavailable
(#25634). -
skipchars(io::IO, predicate; linecomment=nothing)
is deprecated in favor ofskipchars(predicate, io::IO; linecomment=nothing)
(#25667). -
Bidiagonal
constructors now use aSymbol
(:U
or:L
) for the upper/lower argument, instead of aBool
or aChar
(#22703). -
Bidiagonal
,Tridiagonal
andSymTridiagonal
constructors that automatically converted the input vectors to the same type are deprecated in favor of explicit conversion (#22925, #23035, #23154. -
Calling
nfields
on a type to find out how many fields its instances have is deprecated. Usefieldcount
instead. Usenfields
only to get the number of fields in a specific object (#22350). -
fieldnames
now operates only on types. To get the names of fields in an object, usefieldnames(typeof(x))
(#22350). -
InexactError
,DomainError
, andOverflowError
now take arguments.InexactError(func::Symbol, type, -3)
now prints as "ERROR: InexactError: func(type, -3)",DomainError(val, [msg])
prints as "ERROR: DomainError with val:\nmsg", andOverflowError(msg)
prints as "ERROR: OverflowError: msg". (#20005, #22751, #22761) -
The operating system identification functions:
is_linux
,is_bsd
,is_apple
,is_unix
, andis_windows
, have been deprecated in favor ofSys.islinux
,Sys.isbsd
,Sys.isapple
,Sys.isunix
, andSys.iswindows
, respectively (#22182). -
The forms of
read
,readstring
, andeachline
that accepted both aCmd
object and an input stream are deprecated. Use e.g.read(pipeline(stdin, cmd))
instead (#22762). -
The unexported type
AbstractIOBuffer
has been renamed toGenericIOBuffer
(#17360 #22796). -
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). -
Display
has been renamed toAbstractDisplay
(#24831). -
Remaining vectorized methods over
SparseVector
s, particularlyfloor
,ceil
,trunc
,round
, and most common transcendental functions such asexp
,log
, andsin
variants, have been deprecated in favor of dot-syntax (#22961). -
The method
String(io::IOBuffer)
is deprecated toString(take!(copy(io)))
(#21438). -
The function
readstring
is deprecated in favor ofread(io, String)
(#22793) -
The function
showall
is deprecated. Showing entire values is the default, unless anIOContext
specifying:limit=>true
is in use (#22847). -
issubtype
has been deprecated in favor of<:
(which used to be an alias forissubtype
). -
Calling
write
on non-isbits arrays is deprecated in favor of explicit loops orserialize
(#6466). -
The default
startup.jl
file on Windows has been removed. Now must explicitly include the full path if you need access to executables or libraries in theSys.BINDIR
directory, e.g.joinpath(Sys.BINDIR, "7z.exe")
for7z.exe
(#21540). -
sqrtm
has been deprecated in favor ofsqrt
(#23504). -
expm
has been deprecated in favor ofexp
(#23233). -
logm
has been deprecated in favor oflog
(#23505). -
full
has been deprecated in favor of more specific, better defined alternatives. On structured matricesA
, consider insteadMatrix(A)
,Array(A)
,SparseMatrixCSC(A)
, orsparse(A)
. On sparse arraysS
, consider insteadVector(S)
,Matrix(S)
, orArray(S)
as appropriate. On factorizationsF
, consider insteadMatrix(F)
,Array(F)
,AbstractMatrix(F)
, orAbstractArray(F)
. On implicit orthogonal factorsQ
, consider insteadMatrix(Q)
orArray(Q)
; for implicit orthogonal factors that can be recovered in square or truncated form, see the deprecation message for square recovery instructions. OnSymmetric
,Hermitian
, orAbstractTriangular
matricesA
, consider insteadMatrix(S)
,Array(S)
,SparseMatrixCSC(S)
, orsparse(S)
. OnSymmetric
matricesA
particularly, consider insteadLinAlg.copytri!(copy(parent(A)), A.uplo)
. OnHermitian
matricesA
particularly, consider insteadLinAlg.copytri!(copy(parent(A)), A.uplo, true)
. OnUpperTriangular
matricesA
particularly, consider insteadtriu!(copy(parent(A)))
. OnLowerTriangular
matricesA
particularly, consider insteadtril!(copy(parent(A)))
(#24250). -
speye
has been deprecated in favor ofI
,sparse
, andSparseMatrixCSC
constructor methods (#24356). -
Calling
union
with no arguments is deprecated; construct an empty set with an appropriate element type usingSet{T}()
instead (#23144). -
Vectorized
DateTime
,Date
, andformat
methods have been deprecated in favor of dot-syntax (#23207). -
Base.cpad
has been removed; use an appropriate combination ofrpad
andlpad
instead (#23187). -
ctranspose
andctranspose!
have been deprecated in favor ofadjoint
andadjoint!
, respectively (#23235). -
filter
andfilter!
on dictionaries now pass a singlekey=>value
pair to the argument function, instead of two arguments (#17886). -
rol
,rol!
,ror
, andror!
have been deprecated in favor of specialized methods forcircshift
/circshift!
(#23404). -
Base.SparseArrays.SpDiagIterator
has been removed (#23261). -
The 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
,φ
andgolden
have been moved fromBase
to a new module;Base.MathConstants
. Onlyπ
,pi
andℯ
are now exported by default fromBase
(#23427). -
eu
(previously an alias forℯ
) has been deprecated in favor ofℯ
(orMathConstants.e
) (#23427). -
GMP.gmp_version()
,GMP.GMP_VERSION
,GMP.gmp_bits_per_limb()
, andGMP.GMP_BITS_PER_LIMB
have 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!
,selectperm
andselectperm!
have been renamed respectively topartialsort
,partialsort!
,partialsortperm
andpartialsortperm!
(#23051). -
The
Range
abstract type has been renamed toAbstractRange
(#23570). -
map
on dictionaries previously operated onkey=>value
pairs. This behavior is deprecated, and in the futuremap
will operate only on values (#5794). -
map
on sets previously returned aSet
, possibly changing the order or number of elements. This behavior is deprecated and in the futuremap
will 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
broadcast
will 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 typeT
to 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). -
isleaftype
is deprecated in favor of the simpler predicatesisconcretetype
andisdispatchtuple
. Concrete types are those that might equaltypeof(x)
for somex
;isleaftype
included some types for which this is not true. Those are now categorized more precisely as "dispatch tuple types" and "!has_free_typevars" (not exported). (#17086, #25496) -
contains(eq, itr, item)
is deprecated in favor ofany
with a predicate (#23716). -
spdiagm(x::AbstractVector)
has been deprecated in favor ofsparse(Diagonal(x))
alternativelyspdiagm(0 => x)
(#23757). -
spdiagm(x::AbstractVector, d::Integer)
andspdiagm(x::Tuple{<:AbstractVector}, d::Tuple{<:Integer})
have been deprecated in favor ofspdiagm(d => x)
andspdiagm(d[1] => x[1], d[2] => x[2], ...)
respectively. The newspdiagm
implementation now always returns a square matrix (#23757). -
spones(A::AbstractSparseArray)
has been deprecated in favor ofLinAlg.fillstored!(copy(A), 1)
(#25037). -
Constructors for
LibGit2.UserPasswordCredentials
andLibGit2.SSHCredentials
which take aprompt_if_incorrect
argument are deprecated. Instead, prompting behavior is controlled using theallow_prompt
keyword in theLibGit2.CredentialPayload
constructor (#23690). -
gradient
is deprecated and will be removed in the next release (#23816). -
The timing functions
tic
,toc
, andtoq
are deprecated in favor of@time
and@elapsed
(#17046). -
Methods of
findfirst
,findnext
,findlast
, andfindprev
that accept a value to search for are deprecated in favor of passing a predicate (#19186, #10593). -
find
functions now operate only on booleans by default. To look for non-zeros, usex->x!=0
or!iszero
(#23120). -
The ability of
reinterpret
to yieldArray
s of different type than the underlying storage has been removed. Thereinterpret
function is still available, but now returns aReinterpretArray
. The three argument form ofreinterpret
that implicitly reshapes has been deprecated (#23750). -
bits
has been deprecated in favor ofbitstring
(#24281, #24263). -
num2hex
andhex2num
have been deprecated in favor ofreinterpret
combined withparse
/hex
(#22088). -
copy!
is deprecated forAbstractSet
andAbstractDict
, with the intention to re-enable it with a cleaner meaning in a future version (#24844). -
copy!
(resp.unsafe_copy!
) is deprecated forAbstractArray
and is renamedcopyto!
(resp.unsafe_copyto!
); it will be re-introduced with a different meaning in a future version (#24808). -
a:b
is deprecated for constructing aStepRange
whena
andb
have physical units (Dates and Times). Usea:s:b
, wheres = Dates.Day(1)
ors = Dates.Second(1)
. -
trues(A::AbstractArray)
andfalses(A::AbstractArray)
are deprecated in favor oftrues(size(A))
andfalses(size(A))
respectively (#24595). -
workspace
is discontinued, check out Revise.jl for an alternative workflow (#25046). -
cumsum
,cumprod
,accumulate
, their mutating versions, anddiff
all now require adim
argument instead of defaulting to using the first dimension unless there is only one dimension (#24684, #25457). -
The
sum_kbn
andcumsum_kbn
functions have been moved to the KahanSummation package (#24869). -
isnumber
has been renamed toisnumeric
(#25021). -
isalpha
has been renamed toisletter
(#26932). -
is_assigned_char
andnormalize_string
have been renamed toisassigned
andnormalize
, and moved to the newUnicode
standard library module.graphemes
has also been moved to that module (#25021). -
Sparse array functionality has moved to the
SparseArrays
standard library module (#25249). -
Linear algebra functionality, and specifically the
LinAlg
module has moved to theLinearAlgebra
standard library module (#25571). -
@printf
and@sprintf
have been moved to thePrintf
standard library (#23929,#25056). -
The
Libdl
module has moved to theLibdl
standard library module (#25459). -
The aliases
Complex32
,Complex64
andComplex128
have been deprecated in favor ofComplexF16
,ComplexF32
andComplexF64
respectively (#24647). -
Base.parentindexes
andSharedArrays.localindexes
have been renamed toparentindices
andlocalindices
, respectively. Similarly, theindexes
field in theSubArray
type has been renamed toindices
without deprecation (#25088). -
Associative
has been deprecated in favor ofAbstractDict
(#25012). -
Void
has been renamed back toNothing
with an aliasCvoid
for use when calling C with a return type ofCvoid
or 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}
ifnothing
is a possible value (i.e.Nothing <: T
).isnull(x)
can be replaced withx === nothing
andunsafe_get
/get
can be dropped or replaced withcoalesce
.NullException
has been removed. -
unshift!
andshift!
have been renamed topushfirst!
andpopfirst!
(#23902) -
ipermute!
has been deprecated in favor ofinvpermute!
(#25168). -
CartesianRange
has been renamedCartesianIndices
(#24715). -
sub2ind
andind2sub
are deprecated in favor of usingCartesianIndices
andLinearIndices
(#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.Q
instead ofF[:Q]
(#25184). -
search
andrsearch
have been deprecated in favor offindfirst
/findnext
andfindlast
/findprev
respectively, in combination with curriedisequal
andin
predicates 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 ofoccursin(regex, str)
(#26283). -
matchall
has 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_name
has been deprecated in favor of a new, generalnameof
function. Similarly, the unexportedBase.function_name
andBase.datatype_name
have been deprecated in favor ofnameof
methods (#25622). -
The module
Random.dSFMT
is 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 ofAbstractArray
that implement the newly introduced strided array interface should define their ownstrides
method (#25321). -
module_parent
,Base.datatype_module
, andBase.function_module
have 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.randjump
used withaccumulate
(#27746). -
The
assert
function (and@assert
macro) 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. -
ObjectIdDict
has been deprecated in favor ofIdDict{Any,Any}
(#25210). -
gc
andgc_enable
have been deprecated in favor ofGC.gc
andGC.enable
(#25616). -
Base.@gc_preserve
has been deprecated in favor ofGC.@preserve
(#25616). -
print_shortest
has been discontinued, but is still available in theBase.Grisu
submodule (#25745). -
scale!
has been deprecated in favor ofmul!
,lmul!
, andrmul!
(#25701, #25812). -
The
remove_destination
keyword argument tocp
,mv
, and the unexportedcptree
has been renamed toforce
(#25979). -
contains
has been deprecated in favor of a more generaloccursin
function, which takes its arguments in reverse order fromcontains
(#26283). -
Regex
objects are no longer callable. Useoccursin
instead (#26283). -
The methods of
range
based on positional arguments have been deprecated in favor of keyword arguments (#25896). -
linspace
has been deprecated in favor ofrange
withstop
andlength
keyword arguments (#25896). -
LinSpace
has been renamed toLinRange
(#25896). -
logspace
has been deprecated to its definition (#25896). -
endof(a)
has been renamed tolastindex(a)
, and theend
keyword 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 andend
appears 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
, andSTDERR
have been renamed todevnull
,stdin
,stdout
, andstderr
, respectively (#25786). -
wait
andfetch
onTask
now 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
,ucfirst
andlcfirst
have been deprecated in favor ofisuppercase
,islowercase
,uppercasefirst
andlowercasefirst
, respectively (#26442). -
signif
has been deprecated in favor of thesigdigits
keyword argument toround
. -
Base.IntSet
has been deprecated in favor ofBase.BitSet
(#24282). -
setrounding
has been deprecated forFloat32
andFloat64
, as the behaviour was too unreliable (#26935). -
gamma
,lgamma
,beta
,lbeta
andlfact
have been moved to SpecialFunctions.jl (#27459, #27473). -
atan2
is now a 2-argument method ofatan
(#27248). -
The functions
eigs
andsvds
have been moved to theArpack.jl
package (#27616). -
vecdot
andvecnorm
are deprecated in favor ofdot
andnorm
, respectively (#27401). -
clipboard
has been moved to theInteractiveUtils
standard library package (along with other utilities mostly used at the interactive prompt, such asedit
andless
) (#27635). -
ndigits(n, b, [pad])
is deprecated in favor ofndigits(n, base=b, pad=pad)
(#27908). -
squeeze
is deprecated in favor ofdropdims
. -
srand
is deprecated in favor of the unexportedRandom.seed!
(#27726). -
realmin
/realmax
are deprecated in favor offloatmin
/floatmax
(#28302). -
sortrows
/sortcols
have been deprecated in favor of the more generalsortslices
. -
nextpow2
/prevpow2
have been deprecated in favor of the more generalnextpow
/prevpow
functions.
-
New option
--warn-overwrite={yes|no}
to control the warning for overwriting method definitions. The default isno
(#23002). -
New option
--banner={yes,no}
allows suppressing or forcing the printing of the startup banner, overriding the default behavior (banner in REPL, no banner otherwise). The--quiet
option implies--banner=no
even in REPL mode but can be overridden by passing--quiet
together with--banner=yes
(#23342). -
The option
--precompiled
has been renamed to--sysimage-native-code
(#23054). -
The option
--compilecache
has been renamed to--compiled-modules
(#23054).
-
New type system capabilities (#8974, #18457)
-
Type parameter constraints can refer to previous parameters, e.g.
type Foo{R<:Real, A<:AbstractArray{R}}
. Can also be used in method definitions. -
New syntax
Array{T} where T<:Integer
, indicating a union of types over all specified values ofT
(represented by aUnionAll
type). This provides behavior similar to parametric methods ortypealias
, but can be used anywhere a type is accepted. This syntax can also be used in method definitions, e.g.function inv(M::Matrix{T}) where T<:AbstractFloat
. Anonymous functions can have type parameters via the syntax((x::Array{T}) where T<:Real) -> 2x
. -
Implicit type parameters, e.g.
Vector{<:Real}
is equivalent toVector{T} where T<:Real
, and similarly forVector{>:Int}
(#20414). -
Much more accurate subtype and type intersection algorithms. Method sorting and identification of equivalent and ambiguous methods are improved as a result.
-
-
"Inner constructor" syntax for parametric types is deprecated. For example, in this definition:
type Foo{T,S<:Real} x Foo(x) = new(x) end
the syntax
Foo(x) = new(x)
actually defined a constructor forFoo{T,S}
, i.e. the case where the type parameters are specified. For clarity, this definition now must be written asFoo{T,S}(x) where {T,S<:Real} = new(x)
(#11310, #20308). -
The keywords used to define types have changed (#19157, #20418).
-
immutable
changes tostruct
-
type
changes tomutable struct
-
abstract
changes toabstract type ... end
-
bitstype 32 Char
changes toprimitive type Char 32 end
In 0.6,
immutable
andtype
are still allowed as synonyms without a deprecation warning. -
-
Multi-line and single-line nonstandard command literals have been added. A nonstandard command literal is like a nonstandard string literal, but the syntax uses backquotes (
`
) instead of double quotes, and the resulting macro called is suffixed with_cmd
. For instance, the syntaxq`xyz`
is equivalent to@q_cmd "xyz"
(#18644). -
Nonstandard string and command literals can now be qualified with their module. For instance,
Base.r"x"
is now parsed asBase.@r_str "x"
. Previously, this syntax parsed as an implicit multiplication (#18690). -
For every binary operator
⨳
,a .⨳ b
is now automatically equivalent to thebroadcast
call(⨳).(a, b)
. Hence, one no longer defines methods for.*
etcetera. This also means that "dot operations" automatically fuse into a single loop, along with other dot callsf.(x)
(#17623). Similarly for unary operators (#20249). -
Newly defined methods are no longer callable from the same dynamic runtime scope they were defined in (#17057).
-
isa
is now parsed as an infix operator with the same precedence asin
(#19677). -
@.
is now parsed as@__dot__
, and can be used to add dots to every function call, operator, and assignment in an expression (#20321). -
The identifier
_
can be assigned, but accessing its value is deprecated, allowing this syntax to be used in the future for discarding values (#9343, #18251, #20328). -
The
typealias
keyword is deprecated, and should be replaced withVector{T} = Array{T,1}
or aconst
assignment (#20500). -
Experimental feature:
x^n
for integer literalsn
(e.g.x^3
orx^-3
) is now lowered toBase.literal_pow(^, x, Val{n})
, to enable compile-time specialization for literal integer exponents (#20530, #20889).
This section lists changes that do not have deprecation warnings.
-
readline
,readlines
andeachline
return lines without line endings by default. You must usereadline(s, chomp=false)
, etc. to get the old behavior where returned lines include trailing end-of-line character(s) (#19944). -
String
s no longer have a.data
field (as part of a significant performance improvement). UseVector{UInt8}(str)
to access a string as a byte array. However, allocating theVector
object has overhead. You can also usecodeunit(str, i)
to access thei
th byte of aString
. Usesizeof(str)
instead oflength(str.data)
, andpointer(str)
instead ofpointer(str.data)
(#19449). -
Operations between
Float16
andIntegers
now returnFloat16
instead ofFloat32
(#17261). -
Keyword arguments are processed left-to-right: if the same keyword is specified more than once, the rightmost occurrence takes precedence (#17785).
-
The
lgamma(z)
function now uses a different (more standard) branch cut forreal(z) < 0
, which differs fromlog(gamma(z))
by multiples of 2π in the imaginary part (#18330). -
broadcast
now handles tuples, and treats any argument that is not a tuple or an array as a "scalar" (#16986). -
broadcast
now produces aBitArray
instead ofArray{Bool}
for functions yielding a boolean result. If you wantArray{Bool}
, usebroadcast!
or.=
(#17623). -
Broadcast
A[I...] .= X
with entirely scalar indicesI
is deprecated as its behavior will change in the future. UseA[I...] = X
instead. -
Operations like
.+
and.*
onRange
objects are now genericbroadcast
calls (see above) and produce anArray
. If you want aRange
result, use+
and*
, etcetera (#17623). -
broadcast
now treatsRef
(except forPtr
) arguments as 0-dimensional arrays (#18965). -
broadcast
now handles missing data (Nullable
s) allowing operations to be lifted over mixtures ofNullable
s and scalars, as if theNullable
were like an array with zero or one element (#16961, #19787). -
The runtime now enforces when new method definitions can take effect (#17057). The flip-side of this is that new method definitions should now reliably actually take effect, and be called when evaluating new code (#265).
-
The array-scalar methods of
/
,\
,*
,+
, and-
now follow broadcast promotion rules. (Likewise for the now-deprecated array-scalar methods ofdiv
,mod
,rem
,&
,|
, andxor
; see "Deprecated or removed" below.) (#19692). -
broadcast!(f, A)
now callsf()
for each element ofA
, rather than doingfill!(A, f())
(#19722). -
rmprocs
now throws an exception if requested workers have not been completely removed beforewaitfor
seconds. With awaitfor=0
,rmprocs
returns immediately without waiting for worker exits. -
quadgk
has been moved from Base into a separate package (#19741). -
The
Collections
module has been removed, and all functions defined therein have been moved to theDataStructures
package (#19800). -
The
RepString
type has been moved to the LegacyStrings.jl package. -
In macro calls with parentheses, e.g.
@m(a=1)
, assignments are now parsed as=
expressions, instead of askw
expressions (#7669). -
When used as an infix operator,
~
is now parsed as a call to an ordinary operator with assignment precedence, instead of as a macro call (#20406). -
(µ "micro" and ɛ "latin epsilon") are considered equivalent to the corresponding Greek characters in identifiers.
\varepsilon
now tab-completes to U+03B5 (greek small letter epsilon) (#19464). -
retry
now inputs the keyword argumentsdelays
andcheck
instead ofn
andmax_delay
. The previous functionality can be achieved settingdelays
toExponentialBackOff
(#19331). -
transpose(::AbstractVector)
now always returns aRowVector
view of the input (which is a special 1×n-sizedAbstractMatrix
), not aMatrix
, etc. In particular, forv::AbstractVector
we now have(v.').' === v
andv.' * v
is a scalar (#19670). -
Parametric types with "unspecified" parameters, such as
Array
, are now represented asUnionAll
types instead ofDataType
s (#18457). -
Union
types have two fields,a
andb
, instead of a singletypes
field. The empty typeUnion{}
is represented by a singleton of typeTypeofBottom
(#18457). -
The type
NTuple{N}
now refers to tuples where every element has the same type (since it is shorthand forNTuple{N,T} where T
). To get the old behavior of matching any tuple, useNTuple{N,Any}
(#18457). -
FloatRange
has been replaced byStepRangeLen
, and the internal representation ofLinSpace
has changed. Aside from changes in the internal field names, this leads to several differences in behavior (#18777):-
Both
StepRangeLen
andLinSpace
can represent ranges of arbitrary object types---they are no longer limited to floating-point numbers. -
For ranges that produce
Float64
,Float32
, orFloat16
numbers,StepRangeLen
can be used to produce values with little or no roundoff error due to internal arithmetic that is typically twice the precision of the output result. -
To take advantage of this precision,
linspace(start, stop, len)
now returns a range of typeStepRangeLen
rather thanLinSpace
whenstart
andstop
areFloatNN
.LinSpace(start, stop, len)
always returns aLinSpace
. -
StepRangeLen(a, step, len)
constructs an ordinary-precision range using the values and types ofa
andstep
as given, whereasrange(a, step, len)
will attempt to match inputsa::FloatNN
andstep::FloatNN
to rationals and construct aStepRangeLen
that internally uses twice-precision arithmetic. These two outcomes exhibit differences in both precision and speed.
-
-
A=>B
expressions are now parsed as calls instead of using=>
as the expression head (#20327). -
The
count
function no longer sums non-boolean values (#20404) -
The generic
getindex(::AbstractString, ::AbstractVector)
method's signature has been tightened togetindex(::AbstractString, ::AbstractVector{<:Integer})
. Consequently, indexing intoAbstractString
s with non-AbstractVector{<:Integer}
AbstractVector
s now throws aMethodError
in the absence of an appropriate specialization. (Previously such cases failed less explicitly with the exception ofAbstractVector{Bool}
, which now throws anArgumentError
noting that logical indexing into strings is not supported.) (#20248) -
Bessel, Hankel, Airy, error, Dawson, eta, zeta, digamma, inverse digamma, trigamma, and polygamma special functions have been moved from Base to the SpecialFunctions.jl package (#20427). Note that
airy
,airyx
andairyprime
have been deprecated in favor of more specific functions (airyai
,airybi
,airyaiprime
,airybiprimex
,airyaix
,airybix
,airyaiprimex
,airybiprimex
) (#18050). -
When a macro is called in the module in which that macro is defined, global variables in the macro are now correctly resolved in the macro definition environment. Breakage from this change commonly manifests as undefined variable errors that do not occur under 0.5. Fixing such breakage typically requires sprinkling additional
esc
s in the offending macro (#15850). -
write
on anIOBuffer
now returns a signed integer in order to be consistent with other buffers (#20609). -
The
<:Integer
division fallback/(::Integer, ::Integer)
, which formerly inappropriately took precedence over other division methods for some mixed-integer-type division calls, has been removed (#19779). -
@async
,@spawn
,@spawnat
,@fetch
and@fetchfrom
no longer implicitly localize variables. Previously, the expression would be wrapped in an implicitlet
block (#19594). -
parse
no longer accepts IPv4 addresses including leading zeros, octal, or hexadecimal. Convert IPv4 addresses including octal or hexadecimal to decimal, and remove leading zeros in decimal addresses (#19811). -
Closures shipped for remote execution via
@spawn
orremotecall
now automatically serialize globals defined under Main. For details, please refer to the paragraph on "Global variables" under the "Parallel computing" chapter in the manual (#19594). -
homedir
now determines the user's home directory vialibuv
'suv_os_homedir
, rather than from environment variables (#19636). -
Workers now listen on an ephemeral port assigned by the OS. Previously workers would listen on the first free port available from 9009 (#21818).
-
A new
@views
macro was added to convert a whole expression or block of code to use views for all slices (#20164). -
max
,min
, and related functions (minmax
,maximum
,minimum
,extrema
) now returnNaN
forNaN
arguments (#12563). -
oneunit(x)
function to return a dimensionful version ofone(x)
(which is clarified to mean a dimensionless quantity ifx
is dimensionful) (#20268). -
The
chop
andchomp
functions now return aSubString
(#18339). -
Numbered stackframes printed in stacktraces can now be opened in an editor by entering the corresponding number in the REPL and pressing
^Q
(#19680). -
The REPL now supports something called prompt pasting (#17599). This activates when pasting text that starts with
julia>
into the REPL. In that case, only expressions starting withjulia>
are parsed, the rest are removed. This makes it possible to paste a chunk of code that has been copied from a REPL session without having to scrub away prompts and outputs. This can be disabled or enabled at will withBase.REPL.enable_promptpaste(::Bool)
. -
The function
print_with_color
can now take a color represented by an integer between 0 and 255 inclusive as its first argument (#18473). For a number-to-color mapping, please refer to this chart. It is also possible to use numbers as colors in environment variables that customizes colors in the REPL. For example, to get orange warning messages, simply setENV["JULIA_WARN_COLOR"] = 208
. Please note that not all terminals support 256 colors. -
The function
print_with_color
no longer prints text in bold by default (#18628). Instead, the function now take a keyword argumentbold::Bool
which determines whether to print in bold or not. On some terminals, printing a color in non bold results in slightly darker colors being printed than when printing in bold. Therefore, light versions of the colors are now supported. For the available colors see the help entry onprint_with_color
. -
The default text style for REPL input and answers has been changed from bold to normal (#11250). They can be changed back to bold by setting the environment variables
JULIA_INPUT_COLOR
andJULIA_ANSWER_COLOR
to"bold"
. For example, one way of doing this is addingENV["JULIA_INPUT_COLOR"] = :bold
andENV["JULIA_ANSWER_COLOR"] = :bold
to the.juliarc.jl
file. See the manual section on customizing colors for more information. -
The default color for info messages has been changed from blue to cyan (#18442), and for warning messages from red to yellow (#18453). This can be changed back to the original colors by setting the environment variables
JULIA_INFO_COLOR
to"blue"
andJULIA_WARN_COLOR
to"red"
. -
Iteration utilities that wrap iterators and return other iterators (
enumerate
,zip
,rest
,countfrom
,take
,drop
,cycle
,repeated
,product
,flatten
,partition
) have been moved to the moduleBase.Iterators
(#18839). -
BitArrays can now be constructed from arbitrary iterables, in particular from generator expressions, e.g.
BitArray(isodd(x) for x = 1:100)
(#19018). -
hcat
,vcat
, andhvcat
now work withUniformScaling
objects, so you can now do e.g.[A I]
and it will concatenate an appropriately sized identity matrix (#19305). -
New
accumulate
andaccumulate!
functions were added, which generalizecumsum
andcumprod
. Also known as a scan operation (#18931). -
reshape
now allows specifying one dimension with aColon()
(:
) for the new shape, in which case that dimension's length will be computed such that its product with all the other dimensions is equal to the length of the original array (#19919). -
The new
to_indices
function provides a uniform interface for index conversions, taking an array and a tuple of indices as arguments and returning a tuple of integers and/or arrays of supported scalar indices. It will throw anArgumentError
for any unsupported indices, and the returned arrays should be iterated over (and not indexed into) to support more efficient logical indexing (#19730).-
Using colons (
:
) to represent a collection of indices is deprecated. They now must be explicitly converted to a specialized array of integers with theto_indices
function. As a result, the type ofSubArray
s that represent views over colon indices has changed. -
Logical indexing is now more efficient. Logical arrays are converted by
to_indices
to a lazy, iterable collection of indices that doesn't support indexing. A deprecation provides indexing support with O(n) lookup. -
The performance of indexing with
CartesianIndex
es is also improved in many situations.
-
-
A new
titlecase
function was added, to capitalize the first character of each word within a string (#19469). -
any
andall
now always short-circuit, andmapreduce
never short-circuits (#19543). That is, not every member of the input iterable will be visited if atrue
(in the case ofany
) orfalse
(in the case ofall
) value is found, andmapreduce
will visit all members of the iterable. -
Additional methods for
ones
andzeros
functions were added to support the same signature as thesimilar
function (#19635). -
count
now has acount(itr)
method equivalent tocount(identity, itr)
(#20403). -
Methods for
map
andfilter
withNullable
arguments have been implemented; the semantics are as if theNullable
were a container with zero or one elements (#16961). -
New
@test_warn
and@test_nowarn
macros were added in theBase.Test
module to test for the presence or absence of warning messages (#19903). -
logging
can now be used to redirectinfo
,warn
, anderror
messages either universally or on a per-module/function basis (#16213). -
New function
Base.invokelatest(f, args...)
to call the latest version of a function in circumstances where an older version may be called instead (e.g. in a function callingeval
) (#19784). -
A new
iszero(x)
function was added, to quickly check whetherx
is zero (or is all zeros, for an array) (#19950). -
notify
now returns a count of tasks woken up (#19841). -
A new nonstandard string literal
raw"..."
was added, for creating strings with no interpolation or unescaping (#19900). -
A new
Dates.Time
type was added that supports representing the time of day with up to nanosecond resolution (#12274). -
Raising one or negative one to a negative integer power formerly threw a
DomainError
. One raised to any negative integer power now yields one, negative one raised to any negative even integer power now yields one, and negative one raised to any negative odd integer power now yields negative one. Similarly, raisingtrue
to any negative integer power now yieldstrue
rather than throwing aDomainError
(#18342). -
A new
@macroexpand
macro was added as a convenient alternative to themacroexpand
function (#18660). -
invoke
now supports keyword arguments (#20345). -
A new
ConjArray
type was added, as a wrapper type for lazy complex conjugation of arrays. Currently, it is used by default for the newRowVector
type only, and enforces that bothtranspose(vec)
andctranspose(vec)
are views not copies (#20047). -
rem
now accepts aRoundingMode
argument viarem(x, y, r::RoundingMode)
, yieldingx - y*round(x/y, r)
without intermediate rounding. In particular,rem(x, y, RoundNearest)
yields a value in the interval[-abs(y)/2, abs(y)/2]
), which corresponds to the IEE754remainder
function. Similarly,rem2pi(x, r::RoundingMode)
now exists as well, yieldingrem(x, 2pi, r::RoundingMode)
but with greater accuracy (#10946). -
map[!]
andbroadcast[!]
now have dedicated methods for sparse/structured vectors/matrices. Specifically,map[!]
andbroadcast[!]
over combinations including one or moreSparseVector
,SparseMatrixCSC
,Diagonal
,Bidiagonal
,Tridiagonal
, orSymTridiagonal
, and any number ofbroadcast
scalars,Vector
s, orMatrix
s, now efficiently yieldSparseVector
s orSparseMatrix
s as appropriate (#19239, #19371, #19518, #19438, #19690, #19724, #19926, #19934, #20009). -
The operators
!
and∘
(\circ<tab>
at the REPL and in most code editors) now respectively perform predicate function negation and function composition. For example,map(!iszero, (0, 1))
is now equivalent tomap(x -> !iszero(x), (0, 1))
andmap(uppercase ∘ hex, 250:255)
is now equivalent tomap(x -> uppercase(hex(x)), 250:255)
(#17155). -
enumerate
now supports the two-argument formenumerate(::IndexStyle, iterable)
. This form allows specification of the returned indices' style. For example,enumerate(IndexLinear, iterable)
yields linear indices andenumerate(IndexCartesian, iterable)
yields cartesian indices (#16378).
-
ccall
is now implemented as a macro, removing the need for special code-generator support forIntrinsics
(#18754). -
ccall
gained limited support for allvmcall
calling-convention. This can replace many uses ofllvmcall
with a simpler, shorter declaration (#18754). -
All
Intrinsics
are nowBuiltin
functions instead and have proper error checking and fall-back static compilation support (#18754).
-
ipermutedims(A::AbstractArray, p)
has been deprecated in favor ofpermutedims(A, invperm(p))
(#18891). -
Linear indexing is now only supported when there is exactly one non-cartesian index provided. Allowing a trailing index at dimension
d
to linearly access the higher dimensions from arrayA
(beyondsize(A, d)
) has been deprecated as a stricter constraint during bounds checking. Instead,reshape
the array such that its dimensionality matches the number of indices (#20079). -
Multimedia.@textmime "mime"
has been deprecated. Instead defineMultimedia.istextmime(::MIME"mime") = true
(#18441). -
isdefined(a::Array, i::Int)
has been deprecated in favor ofisassigned
(#18346). -
The three-argument
SubArray
constructor (which acceptsdims::Tuple
as its third argument) has been deprecated in favor of the two-argument equivalent (thedims::Tuple
argument being superfluous) (#19259). -
is
has been deprecated in favor of===
(which used to be an alias foris
) (#17758). -
Ambiguous methods for addition and subtraction between
UniformScaling
s andNumber
s, for example(+)(J::UniformScaling, x::Number)
, have been deprecated in favor of unambiguous, explicit equivalents, for exampleJ.λ + x
(#17607). -
num
andden
have been deprecated in favor ofnumerator
anddenominator
respectively (#19233,#19246). -
delete!(ENV::EnvDict, k::AbstractString, def)
has been deprecated in favor ofpop!(ENV, k, def)
. Be aware thatpop!
returnsk
ordef
, whereasdelete!
returnsENV
ordef
(#18012). -
infix operator
$
has been deprecated in favor of infix⊻
or functionxor
(#18977). -
The single-argument form of
write
(write(x)
, with implicitSTDOUT
output stream), has been deprecated in favor of the explicit equivalentwrite(STDOUT, x)
(#17654). -
Dates.recur
has been deprecated in favor offilter
(#19288) -
A number of ambiguous
convert
operations betweenNumber
s (especiallyReal
s) andDate
,DateTime
, andPeriod
types have been deprecated in favor of unambiguousconvert
and explicit constructor calls. Additionally, ambiguous colon construction of<:Period
ranges without step specification, for exampleDates.Hour(1):Dates.Hour(2)
, has been deprecated in favor of such construction including step specification, for exampleDates.Hour(1):Dates.Hour(1):Dates.Hour(2)
(#19920). -
cummin
andcummax
have been deprecated in favor ofaccumulate
(#18931). -
The
Array
constructor syntaxArray(T, dims...)
has been deprecated in favor of the formsArray{T,N}(dims...)
(whereN
is known, or particularlyVector{T}(dims...)
forN = 1
andMatrix{T}(dims...)
forN = 2
), andArray{T}(dims...)
(whereN
is not known). Likewise forSharedArray
s (#19989). -
sumabs
andsumabs2
have been deprecated in favor ofsum(abs, x)
andsum(abs2, x)
, respectively.maxabs
andminabs
have similarly been deprecated in favor ofmaximum(abs, x)
andminimum(abs, x)
. Likewise for the in-place counterparts of these functions (#19598). -
The array-reducing form of
isinteger
(isinteger(x::AbstractArray)
) has been deprecated in favor ofall(isinteger, x)
(#19925). -
produce
,consume
and iteration over a Task object have been deprecated in favor of using Channels for inter-task communication (#19841). -
The
negate
keyword has been deprecated from all functions in theDates
adjuster API (adjust
,tonext
,toprev
,Date
,Time
, andDateTime
). Instead use predicate function negation via the!
operator (see Library Improvements) (#20213). -
@test_approx_eq x y
has been deprecated in favor of@test isapprox(x,y)
or@test x ≈ y
(#4615). -
Matrix()
andMatrix{T}()
have been deprecated in favor of the explicit formsMatrix(0, 0)
andMatrix{T}(0, 0)
(#20330). -
Vectorized functions have been deprecated in favor of dot syntax (#17302, #17265, #18558, #19711, #19712, #19791, #19802, #19931, #20543, #20228).
-
All methods of character predicates (
isalnum
,isalpha
,iscntrl
,isdigit
,isnumber
,isgraph
,islower
,isprint
,ispunct
,isspace
,isupper
,isxdigit
) that acceptAbstractStrings
have been deprecated in favor ofall
. For example,isnumber("123")
should now be expressedall(isnumber, "123")
(#20342). -
A few names related to indexing traits have been changed:
LinearIndexing
andlinearindexing
have been deprecated in favor ofIndexStyle
.LinearFast
has been deprecated in favor ofIndexLinear
, andLinearSlow
has been deprecated in favor ofIndexCartesian
(#16378). -
The two-argument forms of
map
(map!(f, A)
) andasyncmap!
(asyncmap!(f, A)
) have been deprecated in anticipation of future semantic changes (#19721). -
unsafe_wrap(String, ...)
has been deprecated in favor ofunsafe_string
(#19449). -
zeros
andones
methods accepting an element type as the first argument and an array as the second argument, for examplezeros(Float64, [1, 2, 3])
, have been deprecated in favor of equivalent methods with the second argument instead the size of the array, for examplezeros(Float64, size([1, 2, 3]))
(#21183). -
Base.promote_eltype_op
has been deprecated (#19669, #19814, #19937). -
isimag
has been deprecated (#19949). -
The tuple-of-types form of
invoke
,invoke(f, (types...), ...)
, has been deprecated in favor of the tuple-type forminvoke(f, Tuple{types...}, ...)
(#18444). -
Base._promote_array_type
has been deprecated (#19766). -
Methods allowing indexing of tuples by
AbstractArray
s with more than one dimension have been deprecated. (Indexing a tuple by such a higher-dimensionalAbstractArray
should yield a tuple with more than one dimension, but tuples are one-dimensional.) (#19737). -
@test_approx_eq a b
has been deprecated in favor of@test a ≈ b
(or, equivalently,@test ≈(a, b)
or@test isapprox(a, b)
).@test_approx_eq_eps
has been deprecated in favor of new@test
syntax:@test
now supports the syntax@test f(args...) key=val ...
for@test f(args..., key=val...)
. This syntax allows, for example, writing@test a ≈ b atol=c
in place of@test ≈(a, b, atol=c)
(and hence@test_approx_eq_eps a b c
) (#19901). -
takebuf_array
has been deprecated in favor oftake!
, andtakebuf_string(x)
has been deprecated in favor ofString(take!(x))
(#19088). -
convert
methods fromDiagonal
andBidiagonal
to subtypes ofAbstractTriangular
have been deprecated (#17723). -
Base.LinAlg.arithtype
has been deprecated. If you were usingarithtype
within apromote_op
call, instead usepromote_op(Base.LinAlg.matprod, Ts...)
. Otherwise, consider defining equivalent functionality locally (#18218). -
Special characters (
#{}()[]<>|&*?~;
) should now be quoted in commands. For example,`export FOO=1\;`
should replace`export FOO=1;`
and`cd $dir '&&' $thingie`
should replace`cd $dir && $thingie`
(#19786). -
Zero-argument
Channel
constructors (Channel()
,Channel{T}()
) have been deprecated in favor of equivalents accepting an explicitChannel
size (Channel(2)
,Channel{T}(2)
) (#18832). -
The zero-argument constructor
MersenneTwister()
has been deprecated in favor of the explicitMersenneTwister(0)
(#16984). -
Base.promote_type(op::Type, Ts::Type...)
has been removed as part of an overhaul ofbroadcast
's promotion mechanism. If you need the functionality of thatBase.promote_type
method, consider defining it locally viaCore.Compiler.return_type(op, Tuple{Ts...})
(#18642). -
bitbroadcast
has been deprecated in favor ofbroadcast
, which now produces aBitArray
instead ofArray{Bool}
for functions yielding a boolean result (#19771). -
To complete the deprecation of histogram-related functions,
midpoints
has been deprecated. Instead use the StatsBase.jl package'smidpoints
function (#20058). -
Passing a type argument to
LibGit2.cat
has been deprecated in favor of a simpler, two-argument method forLibGit2.cat
(#20435). -
The
LibGit2.owner
function for finding the repository which owns a given Git object has been deprecated in favor ofLibGit2.repository
(#20135). -
The
LibGit2.GitAnyObject
type has been renamed toLibGit2.GitUnknownObject
to clarify its intent (#19935). -
The
LibGit2.GitOid
type has been renamed toLibGit2.GitHash
for clarity (#19878). -
Finalizing
LibGit2
objects withfinalize
has been deprecated in favor of usingclose
(#19660). -
Parsing string dates from a
Dates.DateFormat
object has been deprecated as part of a larger effort toward faster, more extensible date parsing (#20952).
- In
polly
builds (USE_POLLY := 1
), the new flag--polly={yes|no}
controls whether@polly
declarations are respected. (With--polly=no
,@polly
declarations are ignored.) This flag is also available in non-polly
builds (USE_POLLY := 0
), but has no effect (#18159).
-
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 multiplefor
keywords (#4867). -
Fused broadcasting syntax:
f.(args...)
is equivalent tobroadcast(f, args...)
(#15032), and nestedf.(g.(args...))
calls are fused into a singlebroadcast
loop (#17300). Similarly, the syntaxx .= ...
is equivalent to abroadcast!(identity, x, ...)
call and fuses with nested "dot" calls; also,x .+= y
and 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 ∈ X
is now a synonym forx in X
infor
loops and comprehensions, as it already was in comparisons (#13824). -
The
PROGRAM_FILE
global 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()::T
has 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@compat
if you need 0.4 compatibility via theCompat
package). -
User-extensible bounds check elimination is now possible with the new
@boundscheck
macro (#14474). This macro marks bounds checking code blocks, which the compiler may remove when encountered inside an@inbounds
call.
-
Support for multi-threading. Loops with independent iterations can be easily parallelized with the
Threads.@threads
macro. -
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.
Function
is 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)(...) = ...
.call
is 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. Ifx
andy
are arrays,[x, y]
will be an array of arrays (#3737, #2488, #8599). -
using
andimport
are 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
if
keyword 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
NTuple
type has been removed;NTuple{N,T}
is now implemented internally asTuple{Vararg{T,N}}
(#11242). -
Use of the syntax
x::T
to declare the type of a local variable is deprecated. In the future this will always mean type assertion, and declarations should uselocal x::T
instead (#16071). Whenx
is global,x::T = ...
andglobal x::T
used 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
i
slice withi:i
instead. -
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
MethodError
at 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.
-
reshape
is 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). -
mapslices
now re-uses temporary storage. Recipient functions that expect input slices to be persistent should copy data to other storage (#17266). All usages ofmapslices
should 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
Slot
objects instead of as symbols (#15609). -
The information that used to be in the
ast
field of theLambdaStaticData
type is now divided among the fieldscode
,slotnames
,slottypes
,slotflags
,gensymtypes
,rettype
,nargs
, andisva
in theLambdaInfo
type (#15609). -
A <: B
is parsed asExpr(:(<:), :A, :B)
in all cases (#9503). This also applies to the>:
operator. -
Simple 2-argument comparisons like
A < B
are parsed as calls instead of using the:comparison
expression type (#15524). The:comparison
expression type is still produced in ASTs when comparisons are chained (e.g.A < B ≤ C
). -
map
on 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 either0
or-1
.
-
Strings (#16107):
-
The
UTF8String
andASCIIString
types have been merged into a singleString
type (#16058). Useisascii(s)
to check whether a string contains only ASCII characters. Theascii(s)
function now convertss
toString
, raising anArgumentError
exception ifs
is not pure ASCII. -
The
UTF16String
andUTF32String
types and correspondingutf16
andutf32
converter 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 newtranscode
function (see below) or theCwstring
type as accall
argument 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
Char
s andInteger
s are now deprecated (#16024):'x' == 120
now produces a warning but still evaluates totrue
. In the future it may evaluate tofalse
or 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
normalize
andnormalize!
convenience functions for normalizing vectors (#13681). -
QR matrix factorization:
-
A new
SparseVector
type allows for one-dimensional sparse arrays. Slicing and reshaping sparse matrices now return vectors when appropriate. Thesparsevec
function returns a one-dimensional sparse vector instead of a one-column sparse matrix. TheSparseMatrix
module 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
sparse
methods 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
open
function now respectsumask
on 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 anIOContext
object (#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 allIO
types (#16403).
-
-
Parallel computing:
-
pmap
keyword argumentserr_retry=true
anderr_stop=false
are deprecated. Action to be taken on errors can be specified via theon_error
keyword argument. Retry is specified viaretry_n
,retry_on
andretry_max_delay
(#15409, #15975, #16663). -
The functions
remotecall
,remotecall_fetch
, andremotecall_wait
now have the function argument as the first argument to allow for do-block syntax (#13338).
-
-
Statistics:
-
Testing:
-
The
Base.Test
module now has a@testset
feature 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
handler
functionality, 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 thelibgit2
library, rather than running thegit
program, increasing performance (especially on Windows) (#11196). -
Package-development functions like
Pkg.tag
andPkg.publish
have 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
Base
to the Primes.jl package (#16481). -
Most of the combinatorics functions have been moved from
Base
to the Combinatorics.jl package (#13897). -
New
foreach
function 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)
callsf
on each element ofv
, returning nothing. -
The new
Base.StackTraces
module makes stack traces easier to use programmatically (#14469). -
The
libjulia
library is now properly versioned and installed to the public<prefix>/lib
directory, instead of the private<prefix>/lib/julia
directory (#16362). -
System reflection is now more consistently exposed from
Sys
and notBase
(e.g. constants such asWORD_SIZE
andCPU_CORES
).OS_NAME
has been replaced bySys.KERNEL
and always reports the name of the kernel (as reported byuname
). The@windows_only
and@osx
family of macros have been replaced with functions such asis_windows()
andis_apple()
. There is now also a@static
macro that will evaluate the condition of an if-statement at compile time, for when a static branch is required (#16219). -
Date
andDateTime
values 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
. Usemod1
instead (#14140). -
The
FS
module has been renamed toFilesystem
. Calling the functionsisreadable
,iswritable
, andisexecutable
on filesystem paths has been deprecated (#12819). -
RemoteRef
has been deprecated in favor ofRemoteChannel
(#14458). -
super
has been renamed tosupertype
(#14335). -
parseip(str)
has been deprecated in favor ofparse(IPAddr, str)
(#14676). -
readall
has been renamed toreadstring
, andreadbytes
has been renamed toread
(#14608, #14660). -
fieldoffsets(x)
has been deprecated in favor of callingfieldoffset(x, i)
on each field (#14777). -
issym
is deprecated in favor ofissymmetric
to match similar functions (ishermitian
, ...) (#15192). -
scale
is 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
@functorize
macro. -
bitunpack(B)
andbitpack(A)
have been deprecated in favor ofArray(B)
andBitArray(A)
, respectively (#16010). -
xdump
is removed, anddump
now simply shows the full representation of a value.dump
should not be overloaded, since it is for examining concrete structure (#4163). -
sprandbool
has been deprecated in favor ofsprand(Bool, ...)
orsprand(rng, Bool, ...)
(#11688, #16098). -
The lowercase
symbol
function has been deprecated in favor of theSymbol
constructor (#16154). -
writemime
is deprecated, and output methods specifying a MIME type are now methods ofshow
(#14052). -
BLAS utility functions
blas_set_num_threads
,blas_vendor
, andcheck_blas
have been moved to the BLAS module asBLAS.set_num_threads
,BLAS.vendor
, andBLAS.check
(#10548, #16600). -
print_escaped
has been renamed toescape_string
,print_unescaped
has been renamed tounescape_string
, andprint_joined
has been renamed tojoin
(#16603). -
pointer_to_string
has been renamed tounsafe_wrap(String, ...)
, andpointer_to_array
has been renamed tounsafe_wrap(Array, ...)
(#16731). -
sub
andslice
have been deprecated in favor ofview
(#16972). -
Sparse matrix functions
etree
,ereach
,csc_permute
, andsymperm
have been moved to the SuiteSparse.jl package (#12231, #17033). -
The no-op
transpose
fallback for non-numeric arrays has been deprecated. Consider introducing suitabletranspose
methods or callingpermutedims(x, (2, 1))
for matrices andreshape(x, 1, length(x))
for vectors. (#13171, #17075, #17374). -
The following macros have been deprecated (#16219):
@windows
is deprecated in favor ofis_windows()
@unix
is deprecated in favor ofis_unix()
@osx
is deprecated in favor ofis_apple()
@linux
is deprecated in favor ofis_linux()
@windows_only
is deprecated in favor ofif is_windows()
@unix_only
is deprecated in favor ofif is_unix()
@osx_only
is deprecated in favor ofif is_apple()
@linux_only
is deprecated in favor ofif is_linux()
- NOTE: Using
@static
could 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
-F
flag to load~/.juliarc
has been deprecated in favor of--startup-file=yes
(#9482). -
The
-f
and--no-startup
flags to disable loading of~/.juliarc
have been deprecated in favor of--startup-file=no
(#9482). -
The
-P
and--post-boot
flags for evaluating an expression in "interactive mode" have been deprecated in favor of-i -e
(#16854). -
The
--no-history-file
flag to disable loading of~/.julia_history
has 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, ...)
, andcall
can 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 allconvert
methods implicitly define a constructor (#8712, #2403). -
Unicode version 8 is now supported for identifiers etcetera (#7917, #12031).
-
Type parameters now permit any
isbits
type, not justInt
andBool
(#6081). -
Keyword argument names can be computed, using syntax such as
f(; symbol => val)
(#7704). -
The syntax
@generated function
enables 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 end
can 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.ji
file 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
.ji
file includes a list of dependencies (modules and files that were imported/included at precompile-time), and the module is automatically recompiled uponimport
when 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.compilecache
from 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. -
RemoteRef
s 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 ofx
andy
instead (#3737, #2488, #8599). -
Significant improvements to
ccall
andcfunction
-
As a safer alternative to creating pointers (
Ptr
), the managed reference typeRef
has been added. ARef
points 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. ARef
can 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 passx
instead of&x
. -
ccall
is now lowered to callunsafe_convert(T, cconvert(T, x))
on each argument.cconvert
falls back toconvert
, but can be used to convert an argument to an arbitrarily-different representation more suitable for passing to C.unsafe_convert
then handles conversions toPtr
. -
ccall
andcfunction
now support correctly passing and returning structs, following the platform ABI (assuming the C types are mirrored accurately in Julia). -
cfunction
arguments of struct-like Julia types are now passed by value. IfRef{T}
is used as acfunction
argument 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 forisbits
types.
-
-
convert(Ptr,x)
is deprecated for most types, replaced byunsafe_convert
. You can stillconvert
between pointer types, and between pointers andInt
orUInt
. -
Module
__init__
methods no longer swallow thrown exceptions; they now throw anInitError
wrapping the thrown exception (#12576). -
Unsigned
BigInt
literal syntax has been removed (#11105). Unsigned literals larger thanUInt128
now throw a syntax error. -
error(::Exception)
anderror(::Type{Exception})
have been deprecated in favor of using an explicitthrow
(#9690). -
Uint
etcetera are renamed toUInt
(#8905). -
String
is renamed toAbstractString
(#8872). -
FloatingPoint
is renamed toAbstractFloat
(#12162). -
None
is 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). -
Dict
literal 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, andBase
defines it to constructPair
objects (#6739). -
Char
is no longer a subtype ofInteger
(#8816). Char now supports a more limited set of operations withInteger
types:- comparison / equality
Char
+Int
=Char
Char
-Char
=Int
-
round
rounds 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_mstr
macro. Instead, the string is first unindented and thenx_str
is 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 implementgetindex
orsetindex!
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
local
is no longer allowed in global scope. Uselet
instead ofbegin
to 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 x
in a nested scope is now a syntax error ifx
is local to the enclosing scope (#7264/#11985). -
The default
importall Base.Operators
is deprecated, and relying on it will give a warning (#8113). -
remotecall_fetch
andfetch
now 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
@sync
block throw exceptions, they are now collected in aCompositeException
and theCompositeException
thrown.
-
The
-i
option 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-startup
Don't load ~/.juliarc (deprecated, use --startup-file=no)-F
Load ~/.juliarc (deprecated, use --startup-file=yes)`-P, --post-boot <expr>
Evaluate , but don't disable interactive mode (deprecated, use -i -e instead)--no-history-file
Don't load history file (deprecated, use --history-file=no)
-
Functions may be annotated with metadata (
:meta
expressions) to be used by the compiler (#8297). -
@inline
before 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
LinAlg
module is now exported. -
sparse(A)
now takes anyAbstractMatrix
A 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
cholfact
andldltfact
functions now accept aperm
keyword for user-provided permutations and ashift
keyword to factorize a shifted matrix (#10844). -
New
svds
function for the sparse truncated SVD (#9425). -
Symmetric
andHermitian
immutables are now parametrized by the matrix type (#7992). -
New
ordschur
andordschur!
functions for sorting a Schur factorization by the eigenvalues (#8467,#9701). -
Givens
type 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 intocholfact
andldltfact
(#10117). -
Add sparse least squares to
\
by addingqrfact
for sparse matrices based on the SPQR library (#10180). -
Split
Triangular
type intoUpperTriangular
,LowerTriangular
,UnitUpperTriagular
andUnitLowerTriangular
(#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
vecdot
function, analogous tovecnorm
, for Euclidean inner products over any iterable container (#11067). -
p = plan_fft(x)
and similar functions now return aBase.DFT.Plan
object, rather than an anonymous function. Calling it viap(x)
is deprecated in favor ofp * x
orp \ 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
, andP
factors (#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
Cstring
type, 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 typeCwstring
should 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). -
reverseind
function 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
replace
with aRegex
pattern are now supported (#11849). Use thes
string 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 aMatch
object 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
AbstractArray
s. Array iteration should generally be written asfor i in eachindex(A) ... end
rather thanfor i = 1:length(A) ... end
(#8432). -
New implementation of SubArrays with substantial performance and functionality improvements (#8501).
-
AbstractArray subtypes only need to implement
size
andgetindex
for 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
similar
now return anArray
by 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). -
PriorityQueue
now 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 defaultForward
order, orpq = PriorityQueue(KeyType, ValueType, OrderType)
otherwise (#8011). -
Efficient
mean
andmedian
for ranges (#8089). -
deepcopy
recurses 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 EnumValue2
syntax. Enum member values also support abitrary value assignment by the@enum EnumName EnumValue1=1 EnumValue2=10 EnumValue3=20
syntax (#10168). -
New
Dates
module for calendar dates and other time-interval calculations (#7654). -
New
Nullable
type for missing data (#8152). -
A new
Val{T}
type allows one to dispatch on bits-type values (#9452). -
linspace
now returns aLinSpace
object 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 thecolon
operator.
-
-
Arithmetic
-
convert
now 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
log
andlog1p
functions implemented in pure Julia (experimental) (#10008). -
The
MathConst
type has been renamedIrrational
(#11922). -
isapprox
now has simpler and more sensible default tolerances (#12393), supports arrays, and has synonyms≈
(U+2248, LaTeX\approx
) and≉
(U+2249, LaTeX\napprox
) forisapprox
and!isapprox
, respectively (#12472).
-
-
Numbers
-
Random numbers
-
Streamlined random number generation APIs #8246. The default
rand
no longer uses global state in the underlying C library, dSFMT, making it closer to being thread-safe (#8399, #8832). All APIs can now take anAbstractRNG
argument (#8854, #9065). The seed argument tosrand
is now optional (#8320, #8854). The APIs accepting a range argument are extended to accept an arbitraryAbstractArray
(#9049). Passing a range ofBigInt
torand
orrand!
is now supported (#9122). There are speed improvements across the board (#8808, #8941, #8958, #9083). -
The
randexp
andrandexp!
functions are exported (#9144).
-
-
File
-
Added function
readlink
which returns the value of a symbolic link "path" (#10714). -
Added function
ismount
which checks if a directory is a mount point (#11279). -
The
cp
function now accepts keyword argumentsremove_destination
andfollow_symlinks
(#10888). -
The
mv
function now accepts keyword argumentremove_destination
(#11145).
-
-
Pipe()
creates a bidirectional I/O object that can be passed tospawn
orpipeline
for redirecting process streams (#12739). -
Other improvements
-
You can now tab-complete emoji via their short names, using
\:name:<tab>
(#10709). -
gc_enable
subsumesgc_disable
, and also returns the previous GC state. -
assert
,@assert
now throws anAssertionError
exception type (#9734). -
@simd
now rejects invalid control flow (@goto
/ break / continue) in the inner loop body at compile time (#8624). -
The
machinefile
now supports a host count (#7616). -
code_native
now outputs branch labels (#8897). -
Added
recvfrom
to get source address of UDP packets (#9418). -
ClusterManager
performance improvements (#9309) and support for changing transports(#9434). -
Added
Base.get_process_title
/Base.set_process_title
(#9957). -
readavailable
now returns a byte vector instead of a string. -
New
lock
andunlock
functions, operating onReentrantLock
, to lock a stream during concurrent writes from multiple tasks (#10679). -
code_llvm
now outputs stripped IR without debug info or other attached metadata. Usecode_llvm_raw
for the unstripped output (#10747). -
New
withenv(var=>val, ...) do ... end
function to temporarily modify environment variables (#10914). -
New function
relpath
returns a relative filepath to path either from the current directory or from an optional start directory (#10893). -
mktemp
andmktempdir
now 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_free
with libc API ([#12034]). -
mktempdir
andmktemp
now 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
Real
s that are not subtypes ofInteger
(Rational
,AbstractFloat
, etc.) has been deprecated (#10458). -
push!(A)
has been deprecated, useappend!
instead of splatting arguments topush!
(#10400). -
names
for composite datatypes has been deprecated and renamed tofieldnames
(#10332). -
DArray
functionality has been removed fromBase
and is now a standalone package under the JuliaParallel umbrella organization (#10333). -
The
Graphics
module has been removed fromBase
and is now a standalone package (#10150, #9862). -
The
Woodbury
special matrix type has been removed fromLinAlg
(#10024). -
median
andmedian!
no longer accept achecknan
keyword argument (#8605). -
inf
andnan
are 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
,iceil
andiround
are deprecated in favour oftrunc{T<:Integer}(T,x)
,floor{T<:Integer}(T,x)
, etc..trunc
is now always bound-checked;Base.unsafe_trunc
provides the old uncheckeditrunc
behaviour (#9133). -
squeeze
now requires that passed dimension(s) are anInt
or tuple ofInt
s; callingsqueeze
with an arbitrary iterator is deprecated (#9271). Additionally, passed dimensions must be unique and correspond to extant dimensions of the input array. -
randbool
is deprecated. Userand(Bool)
to produce a random boolean value, andbitrand
to produce a random BitArray (#9105, #9569). -
beginswith
is renamed tostartswith
(#9578). -
null
is renamed tonullspace
(#9714). -
The operators
|>
,.>
,>>
, and.>>
as used for process I/O redirection are replaced with thepipeline
function (#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
Libc
andLibdl
, respectively (#10328). -
The functions
parseint
,parsefloat
,float32_isvalid
,float64_isvalid
, and the string-argumentBigInt
andBigFloat
have been replaced byparse
andtryparse
with a type argument. The string macrobig"xx"
can be used to constructBigInt
andBigFloat
literals (#3631, #5704, #9487, #10543, #10955). -
the
--int-literals
compiler 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_utf32
have been replaced by genericisvalid
methods. The single argument formisvalid(value)
can now be used for values of typeChar
,ASCIIString
,UTF8String
,UTF16String
andUTF32String
. 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_timer
andstop_timer
are replaced byTimer
andclose
. -
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
). -
cartesianmap
is deprecated in favor of iterating over aCartesianRange
-
Greatly enhanced performance for passing and returning
Tuple
s (#4042). -
Tuple
s (ofInteger
s,Symbol
s, orBool
s) 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
DenseArray
for 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|no
compiler 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)
-
break
inside afor
loop with multiple ranges now exits the entire loop nest (#5154) -
Local goto statements using the
@goto
and@label
macros (#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.
\alpha
byα
) (#6911). This also works in IJulia and in Emacs (#6920). -
workspace()
function for obtaining a fresh workspace (#1195).
-
isequal
now compares all numbers by value, ignoring type (#6624). -
Implement limited shared-memory parallelism with
SharedArray
s (#5380). -
Well-behaved floating-point ranges (#2333, #5636). Introduced the
FloatRange
type 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.1
or1.0:1/49:27.0
. -
New functions
minmax
andextrema
(#5275). -
New macros
@edit
,@less
,@code_typed
,@code_lowered
,@code_llvm
and@code_native
that all function like@which
(#5832). -
consume(p)
extended toconsume(p, args...)
, allowing it to optionally passargs...
back to the producer (#4775). -
.juliarc.jl
is now loaded for both script and REPL execution (#5076). -
The
Sys
module now includes convenient functions for working with dynamic library handles;Sys.dllist
will list out all paths currently loaded viadlopen
, andSys.dlpath
will lookup a path from a handle -
readdlm
treats 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 anAmosException
in that case (#4967). -
methodswith
now returns an array ofMethod
s (#5464) rather than just printing its results. -
errno([code])
function to get or set the C library'serrno
. -
GitHub
module for interacting with the GitHub API. -
Package improvements
-
Packages are now installed into
.julia/v0.3
by default (or whatever the current Julia version is), so that different versions of Julia can co-exist with incompatible packages. Existing.julia
installations 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
-
Array
assignment (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
Dict
s:D[x,y...]
is now a synonym forD[(x,y...)]
for associationsD
(#4870). -
push!
andunshift!
can push multiple arguments (#4782). -
writedlm
andwritecsv
now accept any iterable collection of iterable rows, in addition toAbstractArray
arguments, and thewritedlm
delimiter can be any printable object (e.g. aString
) instead of just aChar
. -
isempty
now works for any iterable collection (#5827). -
unique
now accepts an optionaldim
argument for finding unique rows or columns of a matrix or regions of a multidimensional array (#5811).
-
-
Number
improvements-
The
ImaginaryUnit
type no longer exists. Instead,im
is of typeComplex{Bool}
. Making this work required changing the semantics of boolean multiplication to approximately,true * x = x
andfalse * x = zero(x)
, which can itself be considered useful (#5468). -
big
is now vectorized (#4766) -
nextpow
andprevpow
now return thea^n
values instead of the exponentn
(#4819) -
Overflow detection in
parseint
(#4874). -
rand
now supports arbitraryRanges
arguments (#5059). -
expm1
andlog1p
now support complex arguments (#3141). -
Broadcasting
.//
is now included (#7094). -
prevfloat
andnextfloat
now saturate at -Inf and Inf, respectively, and have otherwise been fixed to follow the IEEE-754 standard functionsnextDown
andnextUp
(#5025). -
New function
widen
for widening numeric types and values, andwidemul
for multiplying to a larger type (#6169). -
polygamma
,digamma
, andtrigamma
now accept complex arguments, andzeta(s, z)
now provides the Hurwitz zeta (#7125). -
Narrow integer types (< 32 bits) are promoted to
Float64
rather than toFloat32
byfloat(x)
(#7390).
-
-
String
improvements-
Triple-quoted regex strings,
r"""..."""
(#4934). -
New string type,
UTF16String
(#4930), constructed byutf16(s)
from another string, aUint16
array 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). -
CharString
is 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
WString
andwstring
synonyms for eitherUTF16String
andutf16
orUTF32String
andutf32
, respectively, depending on the width ofCwchar_t
(#7016). -
normalize_string
function to perform Unicode normalization, case-folding, and other transformations (#5576). -
pointer(s, i=1)
forByteString
,UTF16String
,UTF32String
, andSubString
s thereof (#5703). -
bytestring
is automatically called onString
arguments 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).
-
condskeel
for 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), andnorm
is now type-stable (#6056). -
New
UniformScaling
matrix type and identityI
constant (#5810). -
None of the concrete matrix factorization types are exported from
Base
by default anymore. -
Sparse linear algebra
-
1-d sparse
getindex
has been implemented (#7047) -
Faster sparse
getindex
(#7131). -
Faster sparse
kron
(#4958). -
sparse(A) \ B
now supports a matrixB
of right-hand sides (#5196). -
eigs(A, sigma)
now uses shift-and-invert for nonzero shiftssigma
and inverse iteration forwhich="SM"
. Ifsigma==nothing
(the new default), computes ordinary (forward) iterations (#5776). -
sprand
is 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
, andMatrix
are 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
Bidiagonal
matrices of generic element types (#5277) -
new algorithms for linear solvers, eigensystems and singular systems of
Diagonal
matrices of generic element types (#5263) -
new algorithms for linear solvers and eigensystems of
Triangular
matrices of generic element types (#5255) -
specialized
inv
anddet
methods forTridiagonal
andSymTridiagonal
based on recurrence relations between principal minors (#5358) -
specialized
transpose
,ctranspose
,istril
,istriu
methods forTriangular
(#5255) andBidiagonal
(#5277) -
new LAPACK wrappers
- condition number estimate
cond(A::Triangular)
(#5255)
- condition number estimate
-
parametrize
Triangular
on matrix type (#7064) -
Lyapunov / Sylvester solver (#7435)
-
eigvals
forSymmetric
,Tridiagonal
andHermitian
matrices 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 theil
th through theiu
th 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
setenv
function for external processes now accepts adir
keyword 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)
-
Range
is now the abstract range type, instead ofRanges
-
New function
range
for constructing ranges by length -
Range
is nowStepRange
, andRange1
is nowUnitRange
. Their constructors accept end points instead of lengths. Both are subtypes of a new abstract typeOrdinalRange
. -
Ranges now support
BigInt
and 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
cov
andcor
, which accept keyword argumentsvardim
,corrected
, andmean
(#6273) -
New functions
randsubseq
andrandsubseq!
to create a random subsequence of an array (#6726) -
New macro
@evalpoly
for efficient inline evaluation of polynomials (#7146). -
The signal filtering function
filt
now accepts an optional initial filter state vector. A new in-place functionfilt!
is also exported (#7513). -
Significantly faster
cumsum
andcumprod
(#7359). -
Implement
findmin
andfindmax
over 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-coverage
and--track-allocation
startup features allow one to measure the number of executions or the amount of memory allocated, respectively, at each line of code (#5423,#7464). -
Profile.init
now 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 == T2
orT1 == Void
(#6073). (You can still explicitlyconvert
one pointer type into another if needed.) -
Sys.shlib_ext
has been renamed toSys.dlext
-
dense
is deprecated in favor offull
(#4759). -
The
Stat
type is renamedStatStruct
(#4670). -
setrounding
,rounding
andsetrounding
now take an additional argument specifying the floating point type to which they apply. The old behaviour and[get/set/with]_bigfloat_rounding
functions are deprecated (#5007). -
cholpfact
andqrpfact
are deprecated in favor of keyword arguments incholfact(..., pivot=true)
andqrfact(..., pivot=true)
(#5330). -
symmetrize!
is deprecated in favor ofBase.LinAlg.copytri!
(#5427). -
myindexes
has been renamed tolocalindexes
(#5475). -
factorize!
is deprecated in favor offactorize
(#5526). -
nnz
counts the number of structural nonzeros in a sparse matrix. Usecountnz
for the actual number of nonzeros (#6769). -
setfield
is renamedsetfield!
(#5748). -
put
andtake
are renamedput!
andtake!
(#5511). -
put!
now returns its first argument, the remote reference (#5819). -
read
methods that modify a passed array are now calledread!
(#5970) -
infs
andnans
are deprecated in favor of the more generalfill
. -
*
anddiv
are no longer supported forChar
. -
Range
is renamedStepRange
andRange1
is renamedUnitRange
.Ranges
is renamedRange
. -
bitmix
is replaced by a 2-argument form ofhash
. -
readsfrom
andwritesto
are replaced byopen
(#6948). -
insert!
now throws aBoundsError
ifindex > 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 3
and 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
import
orusing
statement (#4130). -
In an interactive session (REPL), you can use
;cmd
to runcmd
via 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 newBigFloat
operations. -
New half-precision IEEE floating-point type,
Float16
(#3467). -
Support for setting floating-point rounding modes (#3149).
-
methodswith
shows all methods with an argument of specific type. -
mapslices
provides a general way to perform operations on slices of arrays (#2204). -
repeat
function for constructing Arrays with repeated elements (#3605). -
Collections.PriorityQueue
type andCollections.heap
functions (#2920). -
quadgk
1d-integration routine (#3140). -
erfinv
anderfcinv
functions (#2987). -
varm
,stdm
(#2265). -
digamma
,invdigamma
,trigamma
andpolygamma
for calculating derivatives ofgamma
function (#3233). -
logdet
(#3070). -
Names for C-compatible types:
Cchar
,Clong
, etc. (#2370). -
cglobal
to access global variables (#1815). -
unsafe_pointer_to_objref
(#2468) andpointer_from_objref
(#2515). -
readandwrite
for external processes. -
I/O functions
readbytes
andreadbytes!
(#3878). -
flush_cstdio
function (#3949). -
ClusterManager makes it possible to support different types of compute clusters (#3649, #4014).
-
rmprocs
for removing processors from a parallel computing session. The system can also tolerate to some extent processors that die unexpectedly (#3050). -
interrupt
for interrupting worker processes (#3819). -
timedwait
does a polled wait for an event till a specified timeout. -
Condition
type withwait
andnotify
functions forTask
synchronization. -
versioninfo
provides detailed version information, especially useful when reporting and diagnosing bugs. -
detach
for running child processes in a separate process group. -
setenv
for passing environment variables to child processes. -
ifelse
eagerly-evaluated conditional function, especially useful for vectorized conditionals.
-
isequal
now returnsfalse
for numbers of different types. This makes it much easier to define hashing for new numeric types. Uses ofDict
with numeric keys might need to change to account for this increased strictness. -
A redesigned and rewritten
Pkg
system 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)
removeskey
fromd
and returns the value that was associated with it; it throws an exception ifd
does not containkey
.delete!(d,key)
removeskey
fromd
and succeeds regardless of whetherd
containedkey
or not, returningd
itself in either case. -
Linear-algebra factorization routines (
lu
,chol
, etc.) now returnFactorization
objects (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
,Tridiagonal
andBidiagonal
matrix 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).isbool
andiscomplex
are eliminated in favor of a generaliseltype
function. -
Transitive comparison of floats with rationals (#3102).
-
Fast prime generation with
primes
and fast primality testing withisprime
. -
sum
andcumsum
now 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
, andpartitions
now return iterators instead of a task, andinteger_partitions
has been renamed topartitions
(#3989, #4055). -
isreadable
/iswritable
methods added for more IO types (#3872). -
Much faster and improved
readdlm
andwritedlm
(#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). -
pmap
now works with any iterable collection. -
Options in
pmap
for retrying or ignoring failed tasks. -
New
sinpi(x)
andcospi(x)
functions to compute sine and cosine ofpi*x
more accurately (#4112). -
New implementations of elementary complex functions
sqrt
,log
,asin
,acos
,atan
,tanh
,asinh
,acosh
,atanh
with 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
min
andmax
that do reductions were renamed tominimum
andmaximum
.min(x)
is nowminimum(x)
, andmin(x,(),dim)
is nowminimum(x,dim)
(#4235). -
ComplexPair
was renamed toComplex
and madeimmutable
, andComplex128
and so on are now aliases to the newComplex
type. -
!
was added to the name of many mutating functions, e.g.,push
was renamedpush!
(#907). -
ref
renamed togetindex
, andassign
tosetindex!
(#1484). -
writeable
renamed towritable
(#3874). -
logb
andilogb
renamed toexponent
(#2516). -
quote_string
became a method ofrepr
. -
safe_char
,check_ascii
, andcheck_utf8
replaced byis_valid_char
,is_valid_ascii
, andis_valid_utf8
, respectively. -
each_line
,each_match
,begins_with
,ends_with
,parse_float
,parse_int
, andseek_end
replaced 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_nzs
replaced byfindnz
(#1539). -
DivideByZeroError
replaced byDivideError
. -
addprocs_ssh
,addprocs_ssh_tunnel
, andaddprocs_local
replaced byaddprocs
(with keyword options). -
remote_call
,remote_call_fetch
, andremote_call_wait
replaced byremotecall
,remotecall_fetch
, andremotecall_wait
. -
has
replaced byin
for sets and byhaskey
for dictionaries. -
diagmm
anddiagmm!
replaced byscale
andscale!
(#2916). -
unsafe_ref
andunsafe_assign
replaced byunsafe_load
andunsafe_store!
. -
add_each!
anddel_each!
replaced byunion!
andsetdiff!
. -
isdenormal
renamed toissubnormal
(#3105). -
expr
replaced by direct call toExpr
constructor. -
|
,&
,$
,-
, and~
for sets replaced byunion
,intersect
,symdiff
,setdiff
, andcomplement
(#3272). -
square
function removed. -
pascal
function removed. -
add
andadd!
forSet
replaced bypush!
. -
ls
function deprecated in favor ofreaddir
or;ls
in the REPL. -
start_timer
now expects arguments in units of seconds, not milliseconds. -
Shell redirection operators
|
,>
, and<
eliminated in favor of a new operator|>
(#3523). -
amap
is deprecated in favor of newmapslices
functionality. -
The
Reverse
iterator was removed since it did not work in many cases. -
The
gcd
function now returns a non-negative value regardless of the argument signs, and various other sign problems withinvmod
,lcm
,gcdx
, andpowermod
were fixed (#4811).
-
julia-release-*
executables renamed tojulia-*
, andlibjulia-release
renamed tolibjulia
(#4177). -
Packages will now be installed in
.julia/vX.Y
, where X.Y is the current Julia version.
Too numerous to mention.