Developed with Claude: --- Several functions and types introduced in Julia 1.13 were missing `!!! compat "Julia 1.13"` annotations in their docstrings, and some were absent from the API reference docs entirely. Also ~declare `Base.setindex` as public in base/public.jl, which was inadvertently omitted from the original PR (#59880)~, and fix `nth` → `Iterators.nth` in HISTORY.md following the rename in #61486. --------- Co-authored-by: Claude <claude@users.noreply.github.com>
419 KiB
Julia v1.13 Release Notes
New language features
- New
@__FUNCTION__macro to refer to the innermost enclosing function (#58940). - The character U+1F8B2 (RIGHTWARDS ARROW WITH LOWER HOOK), newly added by Unicode 16,
is now a valid operator with arrow precedence, accessible as
\hookunderrightarrowat the REPL ([JuliaLang/JuliaSyntax.jl#525], #57143). - Support for Unicode 17 (#59534).
Language changes
- The
hashalgorithm and its values have changed for certain types, most notablyAbstractString. Anyhashspecializations for equal types to those that changed, such as some third-party string packages, may need to be deleted (#57509, #59691). - The
hash(::AbstractString)function is now a zero-copy / zero-cost function, based upon providing a correct implementation of thecodeunitanditeratefunctions. Third-party string packages should migrate to the new algorithm by deleting their existing overrides of thehashfunction (#59691).
Command-line option changes
- The option
--sysimage-native-code=nohas been deprecated. - The
JULIA_CPU_TARGETenvironment variable now supports asysimagekeyword to match (or extend) the CPU target used to build the current system image (#58970). - The
--code-coverage=alloption now automatically throws away sysimage caches so that code coverage can be accurately measured on methods within the sysimage. It is thrown away after startup (and after startup.jl), before any user code is executed (#59234). - New
--trace-evalcommand-line option to show expressions being evaluated during top-level evaluation. Supports--trace-eval=locor just--trace-eval(show location only),--trace-eval=full(show full expressions), and--trace-eval=no(disable tracing). Also addsBase.TRACE_EVALglobal control that takes priority over the command-line option and can be set to:no,:loc,:full, ornothing(to use command-line setting) (#57137). - Julia now automatically enables verbose debugging options (
--trace-evalandJULIA_TEST_VERBOSE) when CI debugging has been triggered. i.e. via the "debug logging" UI toggle is enabled on github actions re-runs. Other platforms are supported too (#59551).
Multi-threading changes
- A new
AbstractSpinLockis defined withSpinLock <: AbstractSpinLock(#55944). - A new
PaddedSpinLock <: AbstractSpinLockis defined. It has extra padding to avoid false sharing (#55944).
New library functions
Base.@acquiremacro for a non-closure version ofBase.acquire(f, s::Base.Semaphore), like@lock(#56845).Iterators.nthfunction to access then-th element of a generic iterable (#56580).ispositive(::Real)andisnegative(::Real)are provided for performance and convenience (#53677).- The
fieldindexfunction (to get the index of a struct's field) is now exported (#58119). Base.donotdeleteis now public. It prevents dead code elimination of its arguments (#55774).Sys.sysimage_target()returns the CPU target string used to build the current system image (#58970).Iterators.findeachis a lazy version offindall(#54124).
New library features
fieldoffsetnow also accepts the field name as a symbol asfieldtypealready did (#58100).sort(keys(::Dict))andsort(values(::Dict))now automatically collect; they previously threw (#56978).Base.AbstractOneTois added as a supertype of one-based axes, withBase.OneToas its subtype (#56902).takestring!(::IOBuffer)removes the content from the buffer, returning the content as aString.chopprefixandchopsuffixcan now also accept anAbstractCharas the prefix/suffix to remove.- The
macroexpand(with default true) and the newmacroexpand!(with default false) functions now support alegacyscopeboolean keyword argument to control whether to run the legacy scope resolution pass over the result. The legacy scope resolution code has known design bugs and will be disabled by default in a future version. Users should migrate now by callinglegacyscope=falseor usingmacroexpand!. This may often require fixes to the code callingmacroexpandwithMeta.unescapeandMeta.reescapeor by updating tests to expecthygienic-scopeorescapemarkers might appear in the result. Base.ScopedValues.LazyScopedValue{T}is introduced for scoped values that compute their default using aOncePerProcess{T}callback, allowing for lazy initialization of the default value.AbstractScopedValueis now the abstract base type for bothScopedValueandLazyScopedValue(#59372).- New
Base.active_manifest()function to return the path of the active manifest, likeBase.active_project(). Also can return the manifest that would be used for a given project file (#57937).
Standard library changes
mod(x::AbstractFloat, -Inf)now returnsx(as long asxis finite). This aligns with the C standard and is considered a bug fix (#47102).- Indexless
getindexandsetindex!(i.e.A[]) onReinterpretArraynow correctly throw aBoundsErrorwhen there is more than one element (#58814). randperm!andrandcycle!now support non-ArrayAbstractArrayinputs, assuming they are mutable and their indices are one-based (#58596).shufflenow acceptsNTuplearguments (#56906).
REPL
- The Julia REPL now supports bracketed paste on Windows, which should significantly speed up pasting large code blocks into the REPL (#59825).
- The REPL now provides syntax highlighting for input as you type. See the REPL docs for more info about customization.
- The REPL now supports automatic insertion of closing brackets, parentheses, and quotes. See the REPL docs for more info about customization.
- History searching has been rewritten to use a new interactive modal dialogue, using a fzf-like style.
- The display of
AbstractChars in the main REPL mode now includes LaTeX input information like what is shown in help mode (#58181). - Display of repeated frames and cycles in stack traces has been improved by bracketing them in the trace and treating them consistently (#55841).
- The superscript character U+107A5 𐞥 (MODIFIER LETTER SMALL Q), which was already supported in the language, can now be accessed at the REPL with
\^q(#59544).
Test
Testnow supports theJULIA_TEST_VERBOSEenvironment variable. When set totrue, it enables verbose testset entry/exit messages with timing information and sets the defaultverbose=trueforDefaultTestSetto show detailed hierarchical test summaries (#59295).- Test failures when using the
@testmacro now show evaluated arguments for all function calls (#57825, #57839). - Transparent test sets (
@testset let) now show context when tests error (#58727). @test_throwsnow supports a three-argument form@test_throws ExceptionType pattern exprto test both exception type and message pattern in one call (#59117).- The testset stack was changed to use
ScopedValuerather than task local storage (#53462).
InteractiveUtils
- Introspection utilities such as
@code_typed,@whichand@editnow accept type annotations as substitutes for values, recognizing forms such asf(1, ::Float64, 3)or evensum(::Vector{T}; init = ::T) where {T<:Real}. Type-annotated variables as inf(val::Int; kw::Float64)are not evaluated if the type annotation provides the necessary information, making this syntax compatible with signatures found in stacktraces (#57909, #58222). - Code introspection macros such as
@code_loweredand@code_typednow have a much better support for broadcasting expressions, including broadcasting assignments of the formx .+= f(y)(#58349).
Dates
isoweekdate,isoyear,weeksinyearare now implemented and exported for week based calendars, following ISO week date (#48507).
External dependencies
- 7-Zip updated from p7zip v17.06 to upstream 7-Zip v25.01. On Windows, the full 7z.exe/7z.dll bundle is replaced with standalone 7za.exe, which supports fewer formats but unifies cross-platform behavior (#60025).
Deprecated or removed
- The method
merge(combine::Callable, d::AbstractDict...)is now deprecated to favormergewithinstead (#59775).
Julia v1.12 Release Notes
New language features
- New experimental option
--trimthat creates smaller binaries by removing code not proven to be reachable from entry points. Entry points can be marked usingBase.Experimental.entrypoint(#55047). Not all code is expected to work with this option, and since it is experimental you may encounter problems. - Redefinition of constants is now well defined and follows world age semantics (#57253). Additional redefinitions (e.g. of types) are now allowed. See the new manual chapter on world age.
- A new keyword argument
usings::Boolhas been added tonames, returning all names visible viausing(#54609). - The
@atomicmacro family now supports reference assignment syntax, e.g.@atomic :monotonic v[3] += 4, which modifiesv[3]atomically with monotonic ordering semantics (#54707). The supported syntax allows- atomic fetch (
x = @atomic v[3]), - atomic set (
@atomic v[3] = 4), - atomic modify (
@atomic v[3] += 2), - atomic set once (
@atomiconce v[3] = 2), - atomic swap (
x = @atomicswap v[3] = 2), and - atomic replace (
x = @atomicreplace v[3] 2=>5).
- atomic fetch (
- New option
--task-metrics=yesto enable the collection of per-task timing information, which can also be enabled/disabled at runtime withBase.Experimental.task_metrics(::Bool)(#56320). The available metrics are:- actual running time for the task (
Base.Experimental.task_running_time_ns), and - wall-time for the task (
Base.Experimental.task_wall_time_ns).
- actual running time for the task (
- Support for Unicode 16 (#56925).
Threads.@spawnnow takes a:samepoolargument to specify the same threadpool as the caller.Threads.@spawn :samepool foo()which is shorthand forThreads.@spawn Threads.threadpool() foo()(#57109).- The
@ccallmacro can now take agc_safeargument, that if set to true allows the runtime to run garbage collection concurrently to theccall([#49933]). - A single method covering multiple functions is now allowed in more cases. See issue #54620. ([#58131]).
Language changes
- When a method is replaced with an exactly equivalent one, the old method is not deleted. Instead, the new method takes priority and becomes more specific than the old method. Thus if the new method is deleted later, the old method will resume operating. This can be useful in mocking frameworks (as in SparseArrays, Pluto, and Mocking, among others), as they do not need to explicitly restore the old method. At this time, inference and compilation must be repeated in this situation, but we may eventually be able to re-use the old results (#53415).
- Macro expansion will no longer eagerly recurse into
Expr(:toplevel)expressions returned from macros. Instead, macro expansion of:toplevelexpressions will be delayed until evaluation time. This allows a later expression within a given:toplevelexpression to make use of macros defined earlier in the same:toplevelexpression (#53515). - Trivial infinite loops (like
while true; end) are no longer undefined behavior. Infinite loops that do things (e.g. have side effects or sleep) were never and are still not undefined behavior (#52999). - It is now an error to mark a binding as both
publicandexported (#53664). - Errors during
getfieldnow raise a newFieldErrorexception type instead of the genericErrorException(#54504). - Macros in function-signature-position no longer require parentheses. E.g.
function @main(args) ... endis now permitted, whereasfunction (@main)(args) ... endwas required in prior Julia versions. - Calling
usingon a package name inside of that package of that name (especially relevant for a submodule) now explicitly uses that package without examining the Manifest and environment, which is identical to the behavior of..Name. This appears to better match how users expect this to behave in the wild ([#57727]).
Compiler/Runtime improvements
- Generated LLVM IR now uses pointer types instead of passing pointers as integers.
This affects
llvmcall: Inline LLVM IR should be updated to usei8*orptrinstead ofi32ori64, and remove unneededptrtoint/inttoptrconversions. For compatibility, IR with integer pointers is still supported, but generates a deprecation warning (#53687).
Command-line option changes
- The
-m/--moduleflag can be passed to run themainfunction inside a package with a set of arguments. Thismainfunction should be declared using@mainto indicate that it is an entry point (#52103). - Enabling or disabling color text in Julia can now be controlled with the
NO_COLORorFORCE_COLORenvironment variables. These variables are also honored by Julia's build system (#53742, #56346). --project=@tempstarts Julia with a temporary environment (#51149).- New
--trace-compile-timingoption to report how long each method reported by--trace-compiletook to compile, in ms (#54662). --trace-compilenow prints recompiled methods in yellow or with a trailing comment if color is not supported (#55763).- New
--trace-dispatchoption to report methods that are dynamically dispatched (#55848).
Multi-threading changes
- Julia now defaults to 1 "interactive" thread, in addition to the 1 default "worker" thread. i.e.
-t1,1. This means in default configuration the main task and repl (when in interactive mode), which both run on thread 1, now run within theinteractivethreadpool. The libuv IO loop also runs on thread 1, helping efficient utilization of the worker threadpool used byThreads.@spawn. Asking for specifically 1 thread (-t1/JULIA_NUM_THREADS=1) or0interactive threads will disable the interactive thread i.e.-t1,0orJULIA_NUM_THREADS=1,0, or-tauto,0etc. Asking for more than 1 thread will enable the interactive thread so-t2will set the equivalent of-t2,1. As a reminder, buffers should not be managed based onthreadid()(#57087). - New types are defined to handle the pattern of code that must run once per process, called
a
OncePerProcess{T}type, which allows defining a function that should be run exactly once the first time it is called, and then always return the same result value of typeTevery subsequent time afterwards. There are alsoOncePerThread{T}andOncePerTask{T}types for similar usage with threads or tasks (#55793).
Build system changes
- There are new
Makefiles to build Julia and LLVM using the Binary Optimization and Layout Tool (BOLT). Seecontrib/boltandcontrib/pgo-lto-bolt(#54107).
New library functions
logrange(start, stop; length)makes a range of constant ratio, instead of constant step (#39071).- The new
isfull(c::Channel)function can be used to check ifput!(c, some_value)will block (#53159). waitany(tasks; throw=false)andwaitall(tasks; failfast=false, throw=false)which wait for multiple tasks at once (#53341).uuid7()creates an RFC 9562 compliant UUID with version 7 (#54834).insertdims(array; dims)inserts singleton dimensions into an array --- the inverse operation ofdropdims(#45793).- A new
Fixtype generalizesFix1/Fix2for fixing a single argument (#54653). Sys.detectwsl()tests whether Julia is running inside WSL at runtime (#57069).
New library features
escape_stringtakes additional keyword argumentsascii=true(to escape all non-ASCII characters) andfullhex=true(to require full 4/8-digit hex numbers for u/U escapes, e.g. for C compatibility) (#55099).tempnamecan now take a suffix string to allow the file name to include a suffix and include that suffix in the uniquing checking (#53474).RegexMatchobjects can now be used to constructNamedTuples andDicts (#50988).Lockableis now exported (#54595).Base.require_one_based_indexingandBase.has_offset_axesare now public (#56196).- New
ltruncate,rtruncateandctruncatefunctions for truncating strings to text width, accounting for char widths (#55351). isless(and thuscmp, sorting, etc.) is now supported for zero-dimensionalAbstractArrays (#55772).invokenow supports passing aMethodinstead of a type signature (#56692).invokenow supports passing aCodeInstanceinstead of a type, which can enable certain compiler plugin workflows (#56660).Timer(f, ...)will now match the stickiness of the parent task when creating timer tasks, which can be overridden by the newspawnkeyword argument. This avoids the issue where sticky tasks (i.e.@async) make their parent sticky (#56745).Timernow has readabletimeoutandintervalproperties, and a more descriptiveshowmethod (#57081).sortnow supportsNTuples (#54494).map!(f, A)now stores the results inA, likemap!(f, A, A)orA .= f.(A)(#40632).setprecisionwith a function argument (typically adoblock) is now thread safe. Other forms should be avoided, and types should switch to an implementation usingScopedValue([#51362]).
Standard library changes
gcdx(0, 0)now returns(0, 0, 0)instead of(0, 1, 0)(#40989).fdreturns aRawFDinstead of anInt(#55080).
JuliaSyntaxHighlighting
- A new standard library for applying syntax highlighting to Julia code, this uses
JuliaSyntaxandStyledStringsto implement ahighlightfunction that creates anAnnotatedStringwith syntax highlighting applied (#51810).
LinearAlgebra
rankcan now take aQRPivotedmatrix to allow rank estimation via QR factorization (#54283).- Added keyword argument
algtoeigen,eigen!,eigvalsandeigvals!for self-adjoint matrix types (i.e., the type unionRealHermSymComplexHerm) that allows one to switch between different eigendecomposition algorithms (#49355). - Added a generic version of the (unblocked) pivoted Cholesky decomposition (callable via
cholesky[!](A, RowMaximum())) (#54619). - The number of default BLAS threads now respects process affinity, instead of using the total number of logical threads available on the system (#55574).
- A new function
zeroslikeis added that generates the zero elements for matrix-valued banded matrices. Custom array types may specialize this function to return an appropriate result (#55252). - The matrix multiplication
A * Bcallsmatprod_dest(A, B, T::Type)to generate the destination. This function is now public (#55537). - The function
haszero(T::Type)is used to check if a typeThas a unique zero element defined aszero(T). This is now public (#56223). - A new function
diagviewis added that returns a view into a specific band of anAbstractMatrix(#56175).
Profile
Profile.take_heap_snapshottakes a new keyword argument,redact_data::Bool, which istrueby default. When set, the contents of Julia objects are not emitted in the heap snapshot. This currently only applies to strings (#55326).Profile.print()now colors Base/Core/Package modules similarly to how they are in stacktraces. Also paths, even if truncated, are now clickable in terminals that support URI links to take you to the specifiedJULIA_EDITORfor the given file & line number (#55335).
REPL
- Using the new
usings=truefeature of thenames()function, REPL completions can now complete names visible viausing(#54610). - REPL completions can now complete input lines like
[import|using] Mod: xxx|e.g. completeusing Base.Experimental: @optousing Base.Experimental: @opaque(#54719). - The REPL will now warn if it detects a name is being accessed via a module which does not define it (nor has
a submodule which defines it), and for which the name is not public in that module. For example,
mapis defined in Base, and executingLinearAlgebra.mapin the REPL will now issue a warning the first time it occurs (#54872). - When the result of a REPL input is printed, the output is now truncated to 20 KiB.
This does not affect manual calls to
show,print, etc. (#53959). - Backslash completions now print the respective glyph or emoji next to each matching backslash shortcode (#54800).
Test
- A failing
DefaultTestSetnow prints to screen the random number generator (RNG) of the failed test, to help reproducing a stochastic failure which only depends on the state of the RNG. It is also possible seed a test set by passing therngkeyword argument to@testset:using Test, Random @testset rng=Xoshiro(0x2e026445595ed28e, 0x07bb81ac4c54926d, 0x83d7d70843e8bad6, 0xdbef927d150af80b, 0xdbf91ddf2534f850) begin @test rand() == 0.559472630416976 end
InteractiveUtils
- New macros
@trace_compileand@trace_dispatchfor running an expression with--trace-compile=stderr --trace-compile-timingand--trace-dispatch=stderrrespectively enabled (#55915).
External dependencies
- The terminal info database,
terminfo, is now vendored by default, providing a better REPL user experience whenterminfois not available on the system. Julia can be built without vendoring the database using the Makefile optionWITH_TERMINFO=0(#55411).
Tooling Improvements
- A wall-time profiler is now available for users who need a sampling profiler that captures tasks regardless of their scheduling or running state. This type of profiler enables profiling of I/O-heavy tasks and helps detect areas of heavy contention in the system (#55889).
Julia v1.11 Release Notes
New language features
publicis a new keyword. Symbols marked withpublicare considered public API. Symbols marked withexportare now also treated as public API. The difference betweenpublicandexportis thatpublicnames do not become available whenusinga package/module (#50105).ScopedValueimplements dynamic scope with inheritance across tasks (#50958).- The new macro
Base.Cartesian.@ncallkwis analogous toBase.Cartesian.@ncall, but allows to add keyword arguments to the function call (#51501). - Support for Unicode 15.1 (#51799).
Manifest.tomlfiles can now be renamed in the formatManifest-v{major}.{minor}.tomlto be preferentially picked up by the given julia version. i.e. in the same folder, aManifest-v1.11.tomlwould be used by v1.11 andManifest.tomlby every other julia version. This makes managing environments for multiple julia versions at the same time easier (#43845).@timenow reports a count of any lock conflicts where aReentrantLockhad to wait, plus a new macro@lock_conflictswhich returns that count (#52883).
Language changes
-
During precompilation, the
atexithooks now run before saving the output file. This allows users to safely tear down background state (such as closing Timers and sending disconnect notifications to heartbeat tasks) and cleanup other resources when the program wants to begin exiting. -
Code coverage and malloc tracking is no longer generated during the package precompilation stage. Further, during these modes pkgimage caches are now used for packages that are not being tracked. This means that coverage testing (the default for
julia-actions/julia-runtest) will by default use pkgimage caches for all other packages than the package being tested, likely meaning faster test execution. (#52123) -
Specifying a path in
JULIA_DEPOT_PATHnow results in the expansion of empty strings to omit the default user depot (#51448).
Compiler/Runtime improvements
- Updated GC heuristics to count allocated pages instead of individual objects (#50144).
- A new
LazyLibrarytype is exported fromLibdlfor use in building chained lazy library loads, primarily to be used within JLLs (#50074). - Added support for annotating
Base.@assume_effectson code blocks (#52400). - The libuv library has been updated from a base of v1.44.2 to v1.48.0 (#49937).
Command-line option changes
- The entry point for Julia has been standardized to
Main.main(Base.ARGS). This must be explicitly opted into using the@mainmacro (see the docstring for further details). When opted-in, and julia is invoked to run a script or expression (i.e. usingjulia script.jlorjulia -e expr), julia will subsequently run theMain.mainfunction automatically. This is intended to unify script and compilation workflows, where code loading may happen in the compiler and execution ofMain.mainmay happen in the resulting executable. For interactive use, there is no semantic difference between defining amainfunction and executing the code directly at the end of the script ([50974]). - The
--compiled-modulesand--pkgimagesflags can now be set toexisting, which will cause Julia to consider loading existing cache files, but not to create new ones (#50586 and #52573). - The
--projectargument now accepts@scriptto give a path to a directory with a Project.toml relative to the passed script file.--project=@script/foofor thefoosubdirectory. If no path is given after (i.e.--project=@script) then (like--project=@.) the directory and its parents are searched for a Project.toml (#50864 and #53352)
Multi-threading changes
Threads.@threadsnow supports the:greedyscheduler, intended for non-uniform workloads (#52096).- A new public (but unexported) struct
Base.Lockable{T, L<:AbstractLock}makes it easy to bundle a resource and its lock together (#52898).
Build system changes
- There is a new
Makefileto build Julia and LLVM using the profile-guided and link-time optimizations (PGO and LTO) strategies, seecontrib/pgo-lto/Makefile(#45641).
New library functions
in!(x, s::AbstractSet)will return whetherxis ins, and insertxinsif not.- The new
Libc.mkfifofunction wraps themkfifoC function on Unix platforms (#34587). copyuntil(out, io, delim)andcopyline(out, io)copy data into anout::IOstream (#48273).eachrsplit(string, pattern)iterates split substrings right to left.Sys.username()can be used to return the current user's username (#51897).GC.logging_enabled()can be used to test whether GC logging has been enabled viaGC.enable_logging(#51647).IdSetis now exported from Base and considered public (#53262).
New library features
invmod(n, T)whereTis a native integer type now computes the modular inverse ofnin the modular integer ring thatTdefines (#52180).invmod(n)is an abbreviation forinvmod(n, typeof(n))for native integer types (#52180).replace(string, pattern...)now supports an optionalIOargument to write the output to a stream rather than returning a string (#48625).- New methods
allequal(f, itr)andallunique(f, itr)taking a predicate function (#47679). sizehint!(s, n)now supports an optionalshrinkargument to disable shrinking (#51929).- New function
Docs.hasdoc(module, symbol)tells whether a name has a docstring (#52139). - New function
Docs.undocumented_names(module)returns a module's undocumented public names (#52413). - Passing an
IOBufferas a stdout argument forProcessspawn now works as expected, synchronized withwaitorsuccess, so aBase.BufferStreamis no longer required there for correctness to avoid data races (#52461). - After a process exits,
closewritewill no longer be automatically called on the stream passed to it. Callwaiton the process instead to ensure the content is fully written, then callclosewritemanually to avoid data-races. Or use the callback form ofopento have all that handled automatically. @timednow additionally returns the elapsed compilation and recompilation time (#52889)filtercan now act on aNamedTuple(#50795).Iterators.cycle(iter, n)runs overitera fixed number of times, instead of forever (#47354)zero(::AbstractArray)now applies recursively, sozero([[1,2],[3,4,5]])now produces the additive identity[[0,0],[0,0,0]]rather than erroring (#38064).
Standard library changes
- It's not possible to define
lengthfor stateful iterators in a generally consistent manner. The potential for silently incorrect results forStatefuliterators is addressed by deleting thelength(::Stateful)method. The last type parameter ofStatefulis gone, too. Issue: (#47790), PR: (#51747).
StyledStrings
- A new experimental standard library for handling styling in a more comprehensive and structured way (#49586).
- Three new types around the idea of text with "annotations" (
Pair{Symbol, Any}entries, e.g.:lang => "en"or:face => :magenta). These annotations are preserved across operations (e.g. string concatenation with*) when possible.AnnotatedStringis a newAbstractStringtype. It wraps an underlying string and allows for annotations to be attached to regions of the string. This type is used extensively to hold styling information.AnnotatedCharis a newAbstractChartype. It wraps another char and holds a list of annotations that apply to it.AnnotatedIOBufferis a newIOtype that mimics anIOBuffer, but has specialisedread/writemethods for annotated content. This can be thought of both as a "string builder" of sorts and also as glue between annotated and unannotated content.
- The new
Facesstruct serves as a container for text styling information (think typeface, as well as color and decoration), and comes with a framework to provide a convenient, extensible (viaaddface!), and customisable (with a user'sFaces.tomlandloadfaces!) approach to styled content (#49586). - The new
@styled_strstring macro provides a convenient way of creating aAnnotatedStringwith various faces or other attributes applied (#49586).
Package Manager
- It is now possible to specify "sources" for packages in a
[sources]section in Project.toml. This can be used to add non-registered normal or test dependencies. - Pkg now obeys
[compat]bounds forjuliaand raises an error if the version of the running Julia binary is incompatible with the bounds inProject.toml. Pkg has always obeyed this compat when working with Registry packages. This change affects mostly local packages pkg> addandPkg.addwill now add compat entries for new direct dependencies if the active environment is a package (has anameanduuidentry).- Dependencies can now be directly added as weak deps or extras via the
pkg> add --weak/extra FooorPkg.add("Foo", target=:weakdeps/:extras)forms.
LinearAlgebra
cbrt(::AbstractMatrix{<:Real})is now defined and returns real-valued matrix cube roots of real-valued matrices (#50661).eigvals/eigen(A, bunchkaufman(B))andeigvals/eigen(A, lu(B)), which utilize the Bunchkaufman (LDL) and LU decomposition ofB, respectively, now efficiently compute the generalized eigenvalues (eigen: and eigenvectors) ofAandB. Note: The second argument is the output ofbunchkaufmanorlu(#50471).- There is now a specialized dispatch for
eigvals/eigen(::Hermitian{<:Tridiagonal})which performs a similarity transformation to create a real symmetrix triagonal matrix, and solve that using the LAPACK routines (#49546). - Structured matrices now retain either the axes of the parent (for
Symmetric/Hermitian/AbstractTriangular/UpperHessenberg), or that of the principal diagonal (for banded matrices) (#52480). bunchkaufmanandbunchkaufman!now work for anyAbstractFloat,Rationaland their complex variants.bunchkaufmannow supportsIntegertypes, by making an internal conversion toRational{BigInt}. Added new functioninertiathat computes the inertia of the diagonal factor given by theBunchKaufmanfactorization object of a real symmetric or Hermitian matrix. For complex symmetric matrices,inertiaonly computes the number of zero eigenvalues of the diagonal factor (#51487).- Packages that specialize matrix-matrix
mul!with a method signature of the formmul!(::AbstractMatrix, ::MyMatrix, ::AbstractMatrix, ::Number, ::Number)no longer encounter method ambiguities when interacting withLinearAlgebra. Previously, ambiguities used to arise when multiplying aMyMatrixwith a structured matrix type provided by LinearAlgebra, such asAbstractTriangular, which used to necessitate additional methods to resolve such ambiguities. Similar sources of ambiguities have also been removed for matrix-vectormul!operations (#52837). luandissuccess(::LU)now accept anallowsingularkeyword argument. When set totrue, a valid factorization with rank-deficient U factor will be treated as success instead of throwing an error. Such factorizations are now shown by printing the factors together with a "rank-deficient" note rather than printing a "Failed Factorization" message (#52957).
Logging
Printf
Profile
Random
randnow supports sampling overTupletypes (#35856, #50251).randnow supports sampling overPairtypes (#28705).- When seeding RNGs provided by
Random, negative integer seeds can now be used (#51416). - Seedable random number generators from
Randomcan now be seeded by a string, e.g.seed!(rng, "a random seed")(#51527).
REPL
- Tab complete hints now show in lighter text while typing in the repl. To disable
set
Base.active_repl.options.hint_tab_completes = falseinteractively, or in startup.jl:if VERSION >= v"1.11.0-0" atreplinit() do repl repl.options.hint_tab_completes = false end end ``` ([#51229]). - Meta-M with an empty prompt now toggles the contextual module between the previous non-Main contextual module and Main so that switching back and forth is simple. (#51616, #52670)
SuiteSparse
SparseArrays
Test
Dates
The undocumented function adjust is no longer exported but is now documented
Statistics
- Statistics is now an upgradeable standard library (#46501).
Distributed
pmapnow defaults to using aCachingPool(#33892).
Unicode
DelimitedFiles
InteractiveUtils
Deprecated or removed
Base.map,Iterators.map, andforeachlost their single-argument methods (#52631).
External dependencies
tputis no longer called to check terminal capabilities, it has been replaced with a pure-Julia terminfo parser (#50797).
Tooling Improvements
- CI now performs limited automatic typo detection on all PRs. If you merge a PR with a failing typo CI check, then the reported typos will be automatically ignored in future CI runs on PRs that edit those same files (#51704).
Julia v1.10 Release Notes
New language features
- JuliaSyntax.jl is now used as the default parser, providing better diagnostics and faster
parsing. Set environment variable
JULIA_USE_FLISP_PARSERto1to switch back to the old parser if necessary (and if you find this necessary, please file an issue) (#46372). ⥺(U+297A,\leftarrowsubset) and⥷(U+2977,\leftarrowless) may now be used as binary operators with arrow precedence (#45962).
Language changes
- When a task forks a child, the parent task's task-local RNG (random number generator) is no longer affected. The seeding of child based on the parent task also takes a more disciplined approach to collision resistance, using a design based on the SplitMix and DotMix splittable RNG schemes (#49110).
- A new more-specific rule for methods resolves ambiguities containing Union{} in favor of the method defined explicitly to handle the Union{} argument. This makes it possible to define methods to explicitly handle Union{} without the ambiguities that commonly would result previously. This also lets the runtime optimize certain method lookups in a way that significantly improves load and inference times for heavily overloaded methods that dispatch on Types (such as traits and constructors).
- The "h bar"
ℏ(\hslashU+210F) character is now treated as equivalent toħ(\hbarU+0127). - The
@simdmacro now has more limited and clearer semantics: it only enables reordering and contraction of floating-point operations, instead of turning on all "fastmath" optimizations. If you observe performance regressions due to this change, you can recover previous behavior with@fastmath @simd, if you are OK with all the optimizations enabled by the@fastmathmacro (#49405). - When a method with keyword arguments is displayed in the stack trace view, the textual
representation of the keyword arguments' type is simplified using the new
@Kwargs{key1::Type1, ...}macro syntax (#49959).
Compiler/Runtime improvements
- Updated GC heuristics to count allocated pages instead of object sizes (#50144). This should help some programs that consumed excessive memory before.
- The mark phase of the garbage collector is now multi-threaded (#48600).
- JITLink is enabled by default on Linux aarch64 when Julia is linked to LLVM 15 or later versions (#49745). This should resolve many segmentation faults previously observed on this platform.
- The precompilation process now uses pidfile locks and orchestrates multiple julia processes to only have one process spend effort precompiling while the others wait. Previously all would do the work and race to overwrite the cache files. (#49052)
Command-line option changes
- New option
--gcthreadsto set how many threads will be used by the garbage collector (#48600). The default isN/2whereNis the number of worker threads (--threads) used by Julia.
Build system changes
- SparseArrays and SuiteSparse are no longer included in the default system image, so the core language no longer contains GPL libraries. However, these libraries are still included alongside the language in the standard binary distribution (#44247, #48979, #49266).
New library functions
tanpiis now defined. It computes tan(π*x) more accurately thantan(pi*x)(#48575).fourthroot(x)is now defined inBase.Mathand can be used to compute the fourth root ofx. It can also be accessed using the unicode character∜, which can be typed by\fourthroot<tab>(#48899).Libc.memmove,Libc.memset, andLibc.memcpyare now defined, whose functionality matches that of their respective C calls.Base.isprecompiled(pkg::PkgId)has been added, to identify whether a package has already been precompiled (#50218).
New library features
binomial(x, k)now supports non-integerx(#48124).- A
CartesianIndexis now treated as a "scalar" for broadcasting (#47044). printstylednow supports italic output (#45164).parentandparentindicessupportSubStrings.replace(string, pattern...)now supports an optionalIOargument to write the output to a stream rather than returning a string (#48625).startswithnow supports seekableIOstreams (#43055).
Standard library changes
- The
initialized=truekeyword assignment forsortperm!andpartialsortperm!is now a no-op (#47979). It previously exposed unsafe behavior (#47977). - Printing integral
Rationals will skip the denominator inRational-typed IO context (e.g. in arrays) (#45396).
Package Manager
Pkg.precompilenow acceptstimingas a keyword argument which displays per package timing information for precompilation (e.g.Pkg.precompile(timing=true)).
LinearAlgebra
AbstractQno longer subtypesAbstractMatrix. Moreover,adjoint(Q::AbstractQ)no longer wrapsQin anAdjointtype, but instead in anAdjointQ, that itself subtypesAbstractQ. This change accounts for the fact that typicallyAbstractQinstances behave like function-based, matrix-backed linear operators, and hence don't allow for efficient indexing. Also, manyAbstractQtypes can act on vectors/matrices of different size, acting like a matrix with context-dependent size. With this change,AbstractQhas a well-defined API that is described in detail in the Julia documentation (#46196).- Adjoints and transposes of
Factorizationobjects are no longer wrapped inAdjointandTransposewrappers, respectively. Instead, they are wrapped inAdjointFactorizationandTransposeFactorizationtypes, which themselves subtypeFactorization(#46874). - New functions
hermitianpartandhermitianpart!for extracting the Hermitian (real symmetric) part of a matrix (#31836). - The
normof the adjoint or transpose of anAbstractMatrixnow returns the norm of the parent matrix by default, matching the current behaviour forAbstractVectors (#49020). eigen(A, B)andeigvals(A, B), where one ofAorBis symmetric or Hermitian, are now fully supported (#49533).eigvals/eigen(A, cholesky(B))now computes the generalized eigenvalues (eigen: and eigenvectors) ofAandBvia Cholesky decomposition for positive definiteB. Note: The second argument is the output ofcholesky.
Printf
- Format specifiers now support dynamic width and precision, e.g.
%*sand%*.*g(#40105).
REPL
- When stack traces are printed, the printed depth of types in function signatures will be limited to avoid overly verbose output (#49795).
Test
- The
@test_brokenmacro (or@testwithbroken=true) now complains if the test expression returns a non-boolean value in the same way as a non-broken test (#47804). - When a call to
@testfails or errors inside a function, a larger stacktrace is now printed such that the location of the test within a@testsetcan be retrieved (#49451).
InteractiveUtils
code_nativeand@code_nativenow default to intel syntax instead of AT&T.@time_importsnow shows the timing of any module__init__()s that are run (#49529).
Deprecated or removed
- The
@puremacro is now deprecated. UseBase.@assume_effects :foldableinstead (#48682).
Julia v1.9 Release Notes
New language features
- It is now possible to assign to bindings in another module using
setproperty!(::Module, ::Symbol, x)(#44137). - Slurping in assignments is now also allowed in non-final position. This is handled via
Base.split_rest(#42902). - Character literals now support the same syntax allowed in string literals; i.e. the syntax can
represent invalid UTF-8 sequences as allowed by the
Chartype (#44989). - Support for Unicode 15 (#47392).
- Nested combinations of tuples and named tuples of symbols are now allowed as type parameters (#46300).
- New builtins
getglobal(::Module, ::Symbol[, order])andsetglobal!(::Module, ::Symbol, x[, order])for reading from and writing to globals.getglobalshould now be preferred for accessing globals overgetfield(#44137).
Language changes
- The
@invokemacro introduced in 1.7 is now exported. Additionally, it now usesCore.Typeof(x)rather thanAnywhen a type annotation is omitted for an argumentxso that types passed as arguments are handled correctly (#45807). - The
invokelatestfunction and@invokelatestmacro introduced in 1.7 are now exported (#45831).
Compiler/Runtime improvements
- Time to first execution (TTFX, sometimes called time to first plot) is greatly reduced. Package precompilation now
saves native code into a "pkgimage", meaning that code generated during the precompilation process will not
require compilation after package load. Use of pkgimages can be disabled via
--pkgimages=no(#44527) (#47184). - The known quadratic behavior of type inference is now fixed and inference uses less memory in general. Certain edge cases with auto-generated long functions (e.g. ModelingToolkit.jl with partial differential equations and large causal models) should see significant compile-time improvements (#45276, #45404).
- Non-concrete call sites can now be union-split to be inlined or statically resolved even
if there are multiple dispatch candidates. This may improve runtime performance in certain
situations where object types are not fully known statically, by statically resolving
@nospecialize-d call sites and avoiding excessive compilation (#44512). - All uses of the
@puremacro inBasehave been replaced with the now-preferredBase.@assume_effects(#44776). invoke(f, invokesig, args...)calls to a less-specific method than would normally be chosen forf(args...)are no longer spuriously invalidated when loading package precompile files (#46010).
Command-line option changes
- In Linux and Windows,
--threads=autonow tries to infer the usable number of CPUs from the process affinity which is set typically in HPC and cloud environments (#42340). --math-mode=fastis now a no-op (#41638). Users are encouraged to use the @fastmath macro instead, which has more well-defined semantics.- The
--threadscommand-line option now acceptsauto|N[,auto|M]whereMspecifies the number of interactive threads to create (autocurrently means 1) (#42302). - New option
--heap-size-hint=<size>suggests a size limit to invoke garbage collection more eagerly. The size may be specified in bytes, kilobytes (1000k), megabytes (300M), or gigabytes (1.5G) (#45369).
Multi-threading changes
Threads.@spawnnow accepts an optional first argument::defaultor:interactive. An interactive task desires low latency and implicitly agrees to be short duration or to yield frequently. Interactive tasks will run on interactive threads, if any are specified when Julia is started (#42302).- Threads started outside the Julia runtime (e.g. from C or Java) can now become able to call into Julia code
by calling
jl_adopt_thread. This is done automatically when entering Julia code viacfunctionor a@ccallableentry point. As a consequence, the number of threads can now change during execution (#46609).
Build system changes
New library functions
- New function
Iterators.flatmap(#44792). - New
pkgversion(m::Module)function to get the version of the package that loaded a given module, similar topkgdir(m::Module)(#45607). - New function
stack(x)which generalisesreduce(hcat, x::Vector{<:Vector})to any dimensionality, and allows any iterator of iterators. Methodstack(f, x)generalisesmapreduce(f, hcat, x)and is more efficient (#43334). - New macro
@allocationswhich is similar to@allocatedexcept reporting the total number of allocations rather than the total size of memory allocated (#47367).
New library features
RoundFromZeronow works for non-BigFloattypes (#41246).Dictcan be now shrunk manually bysizehint!(#45004).@timenow separates out % time spent recompiling invalidated methods (#45015).
Standard library changes
- A known concurrency issue in
iteratemethods onDictand other derived objects such askeys(::Dict),values(::Dict), andSetis fixed. These methods ofiteratecan now be called on a dictionary or set shared by arbitrary tasks provided that there are no tasks mutating the dictionary or set (#44534). - Predicate function negation
!fnow returns a composed function(!) ∘ finstead of an anonymous function (#44752). eachslicenow works over multiple dimensions;eachslice,eachrowandeachcolreturn aSlicesobject, which allows dispatching to provide more efficient methods (#32310).@kwdefis now exported and added to the public API (#46273).- An issue with order of operations in
fld1is now fixed (#28973). - Sorting is now always stable by default, as
QuickSortwas stabilized (#45222). Base.splatis now exported. The return value is now aBase.Splatinstead of an anonymous function, which allows for pretty printing (#42717).
Package Manager
LinearAlgebra
- The methods
a / bandb \ awithaa scalar andba vector, which were equivalent toa * pinv(b), have been removed due to the risk of confusion with elementwise division (#44358). - We are now wholly reliant on libblastrampoline (LBT) for calling BLAS and LAPACK. OpenBLAS is shipped by default, but building the system image with other BLAS/LAPACK libraries is not supported. Instead, it is recommended that the LBT mechanism be used for swapping BLAS/LAPACK with vendor provided ones (#44360).
lusupports a new pivoting strategyRowNonZero()that chooses the first non-zero pivot element, for use with new arithmetic types and for pedagogy (#44571).normalize(x, p=2)now supports any normed vector spacex, including scalars (#44925).- The default number of BLAS threads is now set to the number of CPU threads on ARM CPUs, and half the number of CPU threads on other architectures (#45412, #46085).
Printf
- Error messages for bad format strings have been improved, to make it clearer what and where in the format string is wrong (#45366).
Profile
- New function
Profile.take_heap_snapshot(file)that writes a file in Chrome's JSON-based.heapsnapshotformat (#46862).
Random
randnandrandexpnow work for anyAbstractFloattype definingrand(#44714).
REPL
Alt-enow opens the current input in an editor (#33759).- The contextual module which is active in the REPL can be changed (it is
Mainby default), via theREPL.activate(::Module)function or via typing the module in the REPL and pressing the keybinding Alt-m (#33872). - A "numbered prompt" mode which prints numbers for each input and output and stores evaluated results in
Outcan be activated withREPL.numbered_prompt!(). See the manual for how to enable this at startup (#46474). - Tab completion displays available keyword arguments (#43536)
SuiteSparse
- Code for the SuiteSparse solver wrappers has been moved to SparseArrays.jl. Solvers are now re-exported by SuiteSparse.jl.
SparseArrays
- SuiteSparse solvers are now available as submodules of SparseArrays (https://github.com/JuliaSparse/SparseArrays.jl/pull/95).
- UMFPACK (https://github.com/JuliaSparse/SparseArrays.jl/pull/179) and CHOLMOD (https://github.com/JuliaSparse/SparseArrays.jl/pull/206) thread safety are improved by
avoiding globals and using locks. Multithreaded
ldiv!of UMFPACK objects may now be performed safely. - An experimental function
SparseArrays.allowscalar(::Bool)allows scalar indexing of sparse arrays to be disabled or enabled. This function is intended to help find accidental scalar indexing ofSparseMatrixCSCobjects, which is a common source of performance issues (https://github.com/JuliaSparse/SparseArrays.jl/pull/200).
Test
- New fail-fast mode for testsets that will terminate the test run early if a failure or error occurs.
Set either via the
@testsetkwargfailfast=trueor by setting env varJULIA_TEST_FAILFASTto"true"i.e. in CI runs to request the job failure be posted eagerly when issues occur (#45317)
Dates
- Empty strings are no longer incorrectly parsed as valid
DateTimes,Dates orTimes and instead throw anArgumentErrorin constructors andparse, whilenothingis returned bytryparse(#47117).
Distributed
- The package environment (active project,
LOAD_PATH,DEPOT_PATH) is now propagated when adding local workers (e.g. withaddprocs(N::Int)or through the--procs=Ncommand line flag) (#43270). addprocsfor local workers now accepts theenvkeyword argument for passing environment variables to worker processes. This was already supported for remote workers (#43270).
Unicode
graphemes(s, m:n)returns a substring of them-th ton-th graphemes ins(#44266).
DelimitedFiles
- DelimitedFiles has been moved out as a separate package.
Deprecated or removed
External dependencies
- On Linux, now autodetects the system libstdc++ version, and automatically loads the system library if it is newer.
The old behavior of loading the bundled libstdc++ regardless of the system version can be restored by setting the
environment variable
JULIA_PROBE_LIBSTDCXX=0(#46976). - Removed
RPATHfrom the julia binary. On Linux this may break libraries that have failed to setRUNPATH.
Tooling Improvements
- Printing of
MethodErrorand methods (such as frommethods(my_func)) is now prettified and colored consistently with printing of methods in stacktraces (#45069).
Julia v1.8 Release Notes
New language features
- Mutable struct fields may now be annotated as
constto prevent changing them after construction, providing for greater clarity and optimization ability of these objects (#43305). - Type annotations can now be added to global variables to make accessing them type stable (#43671).
- Empty n-dimensional arrays can now be created using multiple semicolons inside square brackets,
e.g.
[;;;]creates a 0×0×0Array(#41618). try-blocks can now optionally have anelse-block which is executed right after the main body only if no errors were thrown (#42211).@inlineand@noinlinecan now be placed within a function body, allowing one to annotate anonymous function (#41312).@inlineand@noinlinecan now be applied to a function at callsite or block to enforce the involved function calls to be (or not to be) inlined (#41328).∀,∃, and∄are now allowed as identifier characters (#42314).- Support for Unicode 14.0.0 (#43443).
Module(:name, false, false)can be used to create amodulethat contains no names (it does not importBaseorCoreand does not contain a reference to itself) (#40110, #42154).
Language changes
- Newly-created Task objects (
@spawn,@async, etc.) now adopt the world age for methods from their parent Task upon creation, instead of using the global latest world at start. This is done to enable inference to eventually optimize these calls. Places that wish for the old behavior may useBase.invokelatest(#41449). - Unbalanced Unicode bidirectional formatting directives are now disallowed within strings and comments, to mitigate the "trojan source" vulnerability (#42918).
Base.ifelseis now defined as a generic function rather than a builtin one, allowing packages to extend its definition (#37343).- Every assignment to a global variable now first goes through a call to
convert(Any, x)(orconvert(T, x)respectively if a typeThas been declared for the global). This means great care should be taken to ensure the invariantconvert(Any, x) === xalways holds, as this change could otherwise lead to unexpected behavior (#43671). - Builtin functions are now a bit more like generic functions, and can be enumerated with
methods(#43865).
Compiler/Runtime improvements
- Bootstrapping time has been improved by about 25% (#41794).
- The LLVM-based compiler has been separated from the run-time library into a new library,
libjulia-codegen. It is loaded by default, so normal usage should see no changes. In deployments that do not need the compiler (e.g. system images where all needed code is precompiled), this library (and its LLVM dependency) can simply be excluded (#41936). - Conditional type constraints are now be forwarded interprocedurally (i.e. propagated from caller to callee).
This allows inference to understand e.g.
Base.ifelse(isa(x, Int), x, 0)returns::Int-value even if the type ofxis not known (#42529). - Julia-level SROA (Scalar Replacement of Aggregates) has been improved: allowing elimination of
getfieldcalls with constant global fields (#42355), enabling elimination of mutable structs with uninitialized fields (#43208), improving performance (#43232), and handling more nestedgetfieldcalls (#43239). - Abstract call sites can now be inlined or statically resolved as long as the call site has a single matching method (#43113).
- Inference now tracks various effects such as side-effectful-ness and nothrow-ness on a per-specialization basis.
Code heavily dependent on constant propagation should see significant compile-time performance improvements and
certain cases (e.g. calls to uninlinable functions that are nevertheless effect free) should see runtime performance
improvements. Effects may be overwritten manually with the
Base.@assume_effectsmacro (#43852).
Command-line option changes
- The default behavior of observing
@inboundsdeclarations is now an option viaautoin--check-bounds=yes|no|auto(#41551). - New option
--strip-metadatato remove docstrings, source location information, and local variable names when building a system image (#42513). - New option
--strip-irto remove the compiler's IR (intermediate representation) of source code when building a system image. The resulting image will only work if--compile=allis used, or if all needed code is precompiled (#42925). - When the program file is
-the code to be executed is read from standard in (#43191).
Multi-threading changes
Threads.@threadsnow defaults to a new:dynamicschedule option which is similar to the previous behavior except that iterations will be scheduled dynamically to available worker threads rather than pinned to each thread. This behavior is more composable with (possibly nested)@spawnand@threadsloops (#43919, #44136).
Build system changes
New library functions
- New function
eachsplit(str)for iteratively performingsplit(str)(#39245). - New function
allequal(itr)for testing if all elements in an iterator are equal (#43354). hardlink(src, dst)can be used to create hard links (#41639).setcpuaffinity(cmd, cpus)can be used to set CPU affinity of sub-processes (#42469).diskstat(path=pwd())can be used to return statistics about the disk (#42248).- New
@showtimemacro to show both the line being evaluated and the@timereport (#42431). - The
LazyStringand thelazy"str"macro were added to support delayed construction of error messages in error paths (#33711).
New library features
@timeand@timevnow take an optional description to allow annotating the source of time reports, e.g.@time "Evaluating foo" foo()(#42431).rangeaccepts eitherstoporlengthas a sole keyword argument (#39241).precisionandsetprecisionnow accept abasekeyword argument (#42428).- TCP socket objects now expose
closewritefunctionality and support half-open mode usage (#40783). extremanow accepts aninitkeyword argument (#36265, #43604).Iterators.countfromnow accepts any type that defines+(#37747).
Standard library changes
- Keys with value
nothingare now removed from the environment inaddenv(#43271). Iterators.reverse(and hencelast) now supportseachlineiterators (#42225).- The
lengthfunction on certain ranges of certain element types no longer checks for integer overflow in most cases. The new functionchecked_lengthis now available, which will try to use checked arithmetic to error if the result may be wrapping. Or use a package such as SaferIntegers.jl when constructing the range (#40382). - Intersect returns a result with the eltype of the type-promoted eltypes of the two inputs (#41769).
- Iterating an
Iterators.Reversenow falls back on reversing the eachindex iterator, if possible (#43110).
InteractiveUtils
- New macro
@time_importsfor reporting any time spent importing packages and their dependencies, highlighting compilation and recompilation time as percentages per import (#41612,#45064).
LinearAlgebra
- The BLAS submodule now supports the level-2 BLAS subroutine
spr!(#42830). cholesky[!]now supportsLinearAlgebra.PivotingStrategy(singleton type) values as its optionalpivotargument: the default ischolesky(A, NoPivot())(vs.cholesky(A, RowMaximum())); the formerVal{true/false}-based calls are deprecated (#41640).- The standard library
LinearAlgebra.jlis now completely independent ofSparseArrays.jl, both in terms of the source code as well as unit testing (#43127). As a consequence, sparse arrays are no longer (silently) returned by methods fromLinearAlgebraapplied toBaseorLinearAlgebraobjects. Specifically, this results in the following breaking changes:- Concatenations involving special "sparse" matrices (
*diagonal) now return dense matrices; As a consequence, theD1andD2fields ofSVDobjects, constructed upongetpropertycalls are now dense matrices. - 3-arg
similar(::SpecialSparseMatrix, ::Type, ::Dims)returns a dense zero matrix. As a consequence, products of bi-, tri- and symmetric tridiagonal matrices with each other result in dense output. Moreover, constructing 3-arg similar matrices of special "sparse" matrices of (nonstatic) matrices now fails for the lack ofzero(::Type{Matrix{T}}).
- Concatenations involving special "sparse" matrices (
Printf
- Now uses
textwidthfor formatting%sand%cwidths (#41085).
Profile
- CPU profiling now records sample metadata including thread and task.
Profile.print()has a newgroupbykwarg that allows grouping by thread, task, or nested thread/task, task/thread, andthreadsandtaskskwargs to allow filtering. Further, percent utilization is now reported as a total or per-thread, based on whether the thread is idle or not at each sample.Profile.fetch()includes the new metadata by default. For backwards compatibility with external profiling data consumers, it can be excluded by passinginclude_meta=false(#41742). - The new
Profile.Allocsmodule allows memory allocations to be profiled. The stack trace, type, and size of each allocation is recorded, and asample_rateargument allows a tunable amount of allocations to be skipped, reducing performance overhead (#42768). - A fixed duration cpu profile can now be triggered by the user during running tasks without
Profilebeing loaded first and the report will show during execution. On MacOS & FreeBSD pressctrl-tor raise aSIGINFO. For other platforms raise aSIGUSR1i.e.% kill -USR1 $julia_pid. Not currently available on windows (#43179).
REPL
RadioMenunow supports optionalkeybindingsto directly select options (#41576).?(x, yfollowed by TAB displays all methods that can be called with argumentsx, y, .... (The space at the beginning prevents entering help-mode.)MyModule.?(x, ylimits the search toMyModule. TAB requires that at least one argument have a type more specific thanAny; use SHIFT-TAB instead of TAB to allow any compatible methods (#38791).- New
errglobal variable inMainset when an expression throws an exception, akin toans. Typingerrreprints the exception information (#40642).
SparseArrays
- The code for SparseArrays has been moved from the Julia repo to the external repo at https://github.com/JuliaSparse/SparseArrays.jl. This is only a code movement and does not impact any usage (#43813).
- New sparse concatenation functions
sparse_hcat,sparse_vcat, andsparse_hvcatreturnSparseMatrixCSCoutput independent from the types of the input arguments. They make concatenation behavior available, in which the presence of some special "sparse" matrix argument resulted in sparse output by multiple dispatch. This is no longer possible after makingLinearAlgebra.jlindependent fromSparseArrays.jl(#43127).
Logging
- The standard log levels
BelowMinLevel,Debug,Info,Warn,Error, andAboveMaxLevelare now exported from the Logging stdlib (#40980).
Unicode
- Added function
isequal_normalizedto check for Unicode equivalence without explicitly constructing normalized strings (#42493). - The
Unicode.normalizefunction now accepts achartransformkeyword that can be used to supply custom character mappings, and aUnicode.julia_chartransformfunction is provided to reproduce the mapping used in identifier normalization by the Julia parser (#42561).
Test
@test_throws "some message" triggers_error()can now be used to check whether the displayed error text contains "some message" regardless of the specific exception type. Regular expressions, lists of strings, and matching functions are also supported (#41888).@testset foo()can now be used to create a test set from a given function. The name of the test set is the name of the called function. The called function can contain@testand other@testsetdefinitions, including to other function calls, while recording all intermediate test results (#42518).TestLoggerandLogRecordare now exported from the Test stdlib (#44080).
Distributed
- SSHManager now supports workers with csh/tcsh login shell, via
addprocs()optionshell=:csh(#41485).
Deprecated or removed
External dependencies
Tooling Improvements
GC.enable_logging(true)can be used to log each garbage collection, with the time it took and the amount of memory that was collected (#43511).
Julia v1.7 Release Notes
New language features
(; a, b) = xcan now be used to destructure propertiesaandbofx. This syntax is equivalent toa = getproperty(x, :a); b = getproperty(x, :b)(#39285).- Implicit multiplication by juxtaposition is now allowed for radical symbols (e.g.
x√yandx∛y) (#40173). - The short-circuiting operators
&&and||can now be dotted to participate in broadcast fusion as.&&and.||(#39594). ⫪(U+2AEA,\Top,\downvDash) and⫫(U+2AEB,\Bot,\upvDash,\indep) may now be used as binary operators with comparison precedence (#39403).- Repeated semicolons can now be used inside array concatenation expressions to separate dimensions
of an array, with the number of semicolons specifying the dimension. Just as a single semicolon
in
[A; B]has always described concatenating in the first dimension (vertically), now two semicolons[A;; B]do so in the second dimension (horizontally), three semicolons;;;in the third, and so on (#33697). - A backslash (
\) before a newline inside a string literal now removes the newline while also respecting indentation. This can be used to split up long strings without newlines into multiple lines of code (#40753). - A backslash before a newline in command literals now always removes the newline, similar to standard string literals, whereas the result was not well-defined before (#40753).
Language changes
macroexpand,@macroexpand, and@macroexpand1no longer wrap errors in aLoadError. To reduce breakage,@test_throwshas been modified so that many affected tests will still pass (#38379).- The middle dot
·(\cdotpU+00b7) and the Greek interpunct·(U+0387) are now treated as equivalent to the dot operator⋅(\cdotU+22c5) (#25157). - The minus sign
−(\minusU+2212) is now treated as equivalent to the hyphen-minus sign-(U+002d) (#40948). - Destructuring will no longer mutate values on the left-hand side while iterating through values on
the right-hand side. In the example of an array
x,x[2], x[1] = xwill now swap the first and second elements ofx, whereas it used to fill both entries withx[1]becausex[2]was mutated during the iteration ofx(#40737). - The default random number generator has changed, so all random numbers will be different (even with the
same seed) unless an explicit RNG object is used.
See the section on the
Randomstandard library below (#40546). Iterators.peel(itr)now returnsnothingwhenitris empty instead of throwing aBoundsError(#39607).- Multiple successive semicolons in an array expression were previously ignored (e.g.,
[1 ;; 2] == [1 ; 2]). This syntax is now used to separate dimensions (see New language features).
Compiler/Runtime improvements
Command-line option changes
- The Julia
--projectoption and theJULIA_PROJECTenvironment variable now support selecting shared environments like.julia/environments/myenvthe same way the package management console does: usejulia --project=@myenvresp.export JULIA_PROJECT="@myenv"(#40025).
Multi-threading changes
- Intrinsics for atomic pointer operations are now defined for certain byte sizes (#37847).
- Support for declaring and using individual fields of a mutable struct as atomic has been
added; see the new
@atomicmacro (#37847). - If the
JULIA_NUM_THREADSenvironment variable is set toauto, then the number of threads will be set to the number of CPU threads (#38952). - Every
Taskobject has a local random number generator state, providing reproducible (schedule-independent) execution of parallel simulation code by default. The default generator is also significantly faster in parallel than in previous versions (#40546). - Tasks can now migrate among threads when they are re-scheduled. Previously, a Task would always run on whichever thread executed it first (#40715).
Build system changes
New library functions
- Two argument methods
findmax(f, domain),argmax(f, domain)and the correspondingminversions (#35316). isunordered(x)returns true ifxis a value that is normally unordered, such asNaNormissing(#35316).- New
keepat!(vector, inds)function which is the inplace equivalent ofvector[inds]for a listindsof integers (#36229). - Two arguments method
lock(f, lck)now accepts aChannelas the second argument (#39312). - New functor
Returns(value), which returnsvaluefor any arguments (#39794). - New macros
@somethingand@coalescewhich are short-circuiting versions ofsomethingandcoalesce, respectively (#40729). - New function
redirect_stdiofor redirectingstdin,stdoutandstderr(#37978). - New macro
Base.@invoke f(arg1::T1, arg2::T2; kwargs...)provides an easier syntax to callinvoke(f, Tuple{T1,T2}, arg1, arg2; kwargs...)(#38438). - New macro
Base.@invokelatest f(args...; kwargs...)providing a convenient way to callBase.invokelatest(f, args...; kwargs...)(#37971).
New library features
- The optional keyword argument
contextofsprintcan now be set to a tuple of:key => valuepairs to specify multiple attributes (#39381). bytes2hexandhex2bytesare no longer limited to arguments of typeUnion{String,AbstractVector{UInt8}}and now only require that they're iterable and have a length (#39710).stat(file)now has a more detailed and user-friendlyshowmethod (#39463).
Standard library changes
countandfindallnow accept anAbstractCharargument to search for a character in a string (#38675).- New methods
range(start, stop)andrange(start, stop, length)(#39228). rangenow supportsstartas an optional keyword argument (#38041).- Some operations on ranges will return a
StepRangeLeninstead of aStepRange, to allow the resulting step to be zero. Previously,λ .* (1:9)gave an error whenλ = 0(#40320). islowercaseandisuppercaseare now compliant with the Unicode lower/uppercase categories (#38574).isevenandisoddfunctions now support non-Integernumeric types (#38976).escape_stringnow accepts a collection of characters via the keywordkeepthat are to be kept as they are (#38597).getindexforNamedTuples now accepts a tuple of symbols in order to index multiple values (#38878).- Subtypes of
AbstractRangenow correctly follow the general array indexing behavior when indexed byBools, erroring for scalarBools and treating arrays (including ranges) ofBoolas logical indices (#31829). keys(::RegexMatch)is now defined to return the capture's keys, by name if named, or by index if not (#37299).keys(::Generator)is now defined to return the iterator's keys (#34678).RegexMatchis now iterable, giving the captured substrings (#34355).lpad/rpadare now defined in terms oftextwidth(#39044).Test.@testnow acceptsbrokenandskipboolean keyword arguments, which mimicTest.@test_brokenandTest.@test_skipbehavior, but allows skipping tests failing only under certain conditions. For examplecan be replaced byif T == Float64 @test_broken isequal(complex(one(T)) / complex(T(Inf), T(-Inf)), complex(zero(T), zero(T))) else @test isequal(complex(one(T)) / complex(T(Inf), T(-Inf)), complex(zero(T), zero(T))) end(#39322).@test isequal(complex(one(T)) / complex(T(Inf), T(-Inf)), complex(zero(T), zero(T))) broken=(T == Float64)@lockis now exported from Base (#39588).- The experimental function
Base.catch_stack()has been renamed tocurrent_exceptions(), exported from Base and given a more specific return type (#29901). - Some degree trigonometric functions,
sind,cosd,tand,asind,acosd,asecd,acscd,acotd,atandnow accept a square matrix (#39758). replace(::String)now accepts multiple patterns, which will be applied left-to-right simultaneously, so only one pattern will be applied to any character, and the patterns will only be applied to the input text, not the replacements (#40484).- New
replacemethods to replace elements of aTuple(#38216).
Package Manager
- If a package is
usingorimported from thejulia>prompt that isn't found but is available from a registry, apkg> addprompt now offers to install the package into the current environment, precompile it, and continue to load it (#39026). - A new
Manifest.tomlformat is now used that captures extensible metadata fields, including the julia version that generated the manifest. Old format manifests are still supported and will be maintained in their original format, unless the user runsPkg.upgrade_manifest()to upgrade the format of the current environment's manifest without re-resolving (#40765). pkg> precompilewill now precompile new versions of packages that are already loaded, rather than postponing to the next session (the?-marked dependencies) (#40345).pkg> rm,pin, andfreenow accept the--allargument to call the action on all packages.- Registries downloaded from the Pkg Server (not git) are no longer uncompressed into files but instead
read directly from the compressed tarball into memory. This improves performance on
filesystems which do not handle a large number of files well. To turn this feature off, set the
environment variable
JULIA_PKG_UNPACK_REGISTRY=true. - It is now possible to use an external
gitexecutable instead of the default libgit2 library for the downloads that happen via the Git protocol by setting the environment variableJULIA_PKG_USE_CLI_GIT=true. - Registries downloaded from the Pkg Server (not git) is now assumed to be immutable. Manual changes to their files might not be picked up by a running Pkg session.
- Adding packages by directory name in the REPL mode now requires prepending
./to the name if the package is in the current directory; e.g.add ./Packageis required instead ofadd Package. This is to avoid confusion between the package namePackageand the local directoryPackage. - The
modekeyword forPackageSpechas been removed.
LinearAlgebra
- Use Libblastrampoline to pick a BLAS and LAPACK at runtime. By default it forwards to OpenBLAS in the Julia distribution. The forwarding mechanism can be used by packages to replace the BLAS and LAPACK with user preferences (#39455).
- On aarch64, OpenBLAS now uses an ILP64 BLAS like all other 64-bit platforms (#39436).
- OpenBLAS is updated to 0.3.13 (#39216).
- SuiteSparse is updated to 5.8.1 (#39455).
- The shape of an
UpperHessenbergmatrix is preserved under certain arithmetic operations, e.g. when multiplying or dividing by anUpperTriangularmatrix (#40039). - Real quasitriangular Schur factorizations
Scan now be efficiently converted to complex upper-triangular form withSchur{Complex}(S)(#40573). cis(A)now supports matrix arguments (#40194).dotnow supportsUniformScalingwithAbstractMatrix(#40250).qr[!]andlu[!]now supportLinearAlgebra.PivotingStrategy(singleton type) values as their optionalpivotargument: defaults areqr(A, NoPivot())(vs.qr(A, ColumnNorm())for pivoting) andlu(A, RowMaximum())(vs.lu(A, NoPivot())without pivoting); the formerVal{true/false}-based calls are deprecated (#40623).det(M::AbstractMatrix{BigInt})now callsdet_bareiss(M), which uses the Bareiss algorithm to calculate precise values (#40868).
Markdown
Printf
Random
- The default random number generator has been changed from Mersenne Twister to Xoshiro256++. The new generator has smaller state, better performance, and superior statistical properties. This generator is the one used for reproducible Task-local randomness (#40546).
REPL
- Long strings are now elided using the syntax
"head" ⋯ 12345 bytes ⋯ "tail"when displayed in the REPL (#40736). - Pasting repl examples into the repl (prompt pasting) now supports all repl modes (
julia,pkg,shell,help?) and switches mode automatically (#40604). help?>for modules without docstrings now returns a list of exported names and prints the contents of an associatedREADME.mdif found (#39093).
SparseArrays
- new
sizehint!(::SparseMatrixCSC, ::Integer)method (#30676). cholesky()now fully preserves the user-specified permutation (#40560).issparsenow applies consistently to all wrapper arrays, including nested, by checkingissparseon the wrapped parent array (#37644).
Dates
- The
Dates.periodsfunction can be used to get theVectorofPeriods that comprise aCompoundPeriod(#39169).
Downloads
- If a cookie header is set in a redirected request, the cookie will now be sent in following requests (https://github.com/JuliaLang/Downloads.jl/pull/98).
- If a
~/.netrcfile exists, it is used to get passwords for authenticated websites (https://github.com/JuliaLang/Downloads.jl/pull/98). - Server Name Indication is now sent with all TLS connections, even when the server's identity is not verified (see NetworkOptions; https://github.com/JuliaLang/Downloads.jl/pull/114).
- When verifying TLS connections on Windows, if the certificate revocation server cannot be reached, the connection is allowed; this matches what other applications do and how revocation is performed on macOS (https://github.com/JuliaLang/Downloads.jl/pull/115).
- There is now a 30-second connection timeout and a 20-second timeout if no data is sent; in combination, this guarantees that connections must make some progress or they will timeout in under a minute (https://github.com/JuliaLang/Downloads.jl/pull/126).
Statistics
Sockets
Tar
Tar.extractnow ignores the exact permission mode in a tarball and normalizes modes in the same way thatTar.createdoes, which is, in turn the same way thatgitnormalizes them (https://github.com/JuliaIO/Tar.jl/pull/99).- Functions that consume tarballs now handle hard links: the link target must be a previously seen
file;
Tar.listlists the entry with:hardlinktype and.linkfield giving the path to the target; other functions —Tar.extract,Tar.rewrite,Tar.tree_hash— treat a hard link as a copy of the target file (https://github.com/JuliaIO/Tar.jl/pull/102). - The standard format generated by
Tar.createandTar.rewritenow includes entries for non-empty directories; this shouldn't be necessary, but some tools that consume tarballs (including docker) are confused by the absence of these directory entries (https://github.com/JuliaIO/Tar.jl/pull/106). Tarnow accepts tarballs with leading spaces in octal integer header fields: this is technically not a valid format according to the POSIX spec, but old Solaristarcommands produced tarballs like this so this format does occur in the wild, and it seems harmless to accept it (https://github.com/JuliaIO/Tar.jl/pull/116).Tar.extractnow takes aset_permissionskeyword argument, which defaults totrue; iffalseis passed instead, the permissions of extracted files are not modified on extraction (https://github.com/JuliaIO/Tar.jl/pull/113).
Distributed
UUIDs
Mmap
mmapis now exported (#39816).
DelimitedFiles
readdlmnow defaults touse_mmap=falseon all OSes for consistent reliability in abnormal filesystem situations (#40415).
Deprecated or removed
External dependencies
Tooling Improvements
Julia v1.6 Release Notes
New language features
- Types written with
wheresyntax can now be used to define constructors, e.g.(Foo{T} where T)(x) = .... <--and<-->are now available as infix operators, with the same precedence and associativity as other arrow-like operators (#36666).- Compilation and type inference can now be enabled or disabled at the module level
using the experimental macro
Base.Experimental.@compiler_options(#37041). - The library name passed to
ccallor@ccallcan now be an expression involving global variables and function calls. The expression will be evaluated the first time theccallexecutes (#36458). ꜛ(U+A71B),ꜜ(U+A71C) andꜝ(U+A71D) can now also be used as operator suffixes. They can be tab-completed from\^uparrow,\^downarrowand\^!in the REPL (#37542).- Standalone "dotted" operators now get parsed as
Expr(:., :op), which gets lowered toBase.BroadcastFunction(op). This means.opis functionally equivalent to(x...) -> (op).(x...), which can be useful for passing the broadcasted version of an operator to higher-order functions, for examplemap(.*, A, B)for an elementwise product of two arrays of arrays (#37583). - The syntax
import A as B(plusimport A: x as y,import A.x as y, andusing A: x as y) can now be used to rename imported modules and identifiers (#1255). - Unsigned literals (starting with
0x) which are too big to fit in aUInt128object are now interpreted asBigInt(#23546). - It is now possible to use
...on the left-hand side of assignments for taking any number of items from the front of an iterable collection, while also collecting the rest, for examplea, b... = [1, 2, 3]. This syntax is implemented usingBase.rest, which can be overloaded to customize its behavior for different collection types (#37410).
Language changes
- The postfix conjugate transpose operator
'now accepts Unicode modifiers as suffixes, so e.g.a'ᵀis parsed asvar"'ᵀ"(a), which can be defined by the user.a'ᵀparsed asa' * ᵀbefore, so this is a minor breaking change (#37247). - Macros that return
:quoteexpressions (e.g. viaExpr(:quote, ...)) were previously able to work without escaping (esc(...)) their output when needed. This has been corrected, and nowescmust be used in these macros as it is in other macros (#37540). - The
-->operator now lowers to a:callexpression, so it can be defined as a function like other operators. The dotted version.-->is now parsed as well. For backwards compatibility,-->still parses using its own expression head instead of:call. - The
a[begin, k]syntax now callsfirstindex(a, 1)rather thanfirst(axes(a, 1))(#35779), but the former now defaults to the latter for anya(#38742). ⌿(U+233F) and¦(U+00A6) are now infix operators with times-like and plus-like precedence, respectively. Previously they were parsed as identifier characters (#37973).
Compiler/Runtime improvements
- All platforms can now use
@executable_pathwithinjl_load_dynamic_library(). This allows executable-relative paths to be embedded within executables on all platforms, not just MacOS, which the syntax is borrowed from (#35627). - Constant propagation now occurs through keyword arguments (#35976).
- The precompilation cache is now created atomically (#36416). Invoking n Julia processes simultaneously may create n temporary caches.
Command-line option changes
- There is no longer a concept of "home project": starting
julia --project=diris now exactly equivalent to startingjuliaand then doingpkg> activate $dirandjulia --projectis exactly equivalent to doing that wheredir = Base.current_project(). In particular, this means that if you dopkg> activateafter startingjuliawith the--projectoption (or withJULIA_PROJECTset) it will take you to the default active project, which is@v1.6unless you have modifiedLOAD_PATH(#36434).
Multi-threading changes
- Locks now automatically inhibit finalizers from running, to avoid deadlock (#38487).
- New function
Base.Threads.foreach(f, channel::Channel)for multithreadedChannelconsumption (#34543).
Build system changes
- Windows Installer now has the option to 'Add Julia to Path'. To unselect this option
from the commandline simply remove the tasks you do not want to be installed: e.g.
./julia-installer.exe /TASKS="desktopicon,startmenu,addtopath", adds a desktop icon, a startmenu group icon, and adds Julia to system PATH.
New library functions
- New function
Base.kron!and corresponding overloads for various matrix types for performing Kronecker product in-place (#31069). - New function
Base.readeach(io, T)for iteratively performingread(io, T)(#36150). Iterators.mapis added. It provides another syntaxIterators.map(f, iterators...)for writing(f(args...) for args in zip(iterators...)), i.e. a lazymap(#34352).- New function
sincospifor simultaneously computingsinpi(x)andcospi(x)more efficiently (#35816). - New function
cispi(x)for more accurately computingcis(pi * x)(#38449). - New function
addenvfor adding environment mappings into aCmdobject, returning the newCmdobject. - New function
insortedfor determining whether an element is in a sorted collection or not (#37490). - New function
Base.restfor taking the rest of a collection, starting from a specific iteration state, in a generic way (#37410).
New library features
- The
redirect_*functions now acceptdevnullto discard all output redirected to it, and as an empty input (#36146). - The
redirect_*functions can now be called onIOContextobjects (#36688). findfirst,findnext,findlast, andfindallnow supportAbstractVector{<:Union{Int8,UInt8}}(pattern, array) arguments (#37283).- New constructor
NamedTuple(iterator)that constructs a named tuple from a key-value pair iterator. - A new
reinterpret(reshape, T, a::AbstractArray{S})reinterpretsato have eltypeTwhile potentially inserting or consuming the first dimension depending on the ratio ofsizeof(T)andsizeof(S). - New
append!(vector, collections...)andprepend!(vector, collections...)methods accept multiple collections to be appended or prepended (#36227). keys(io::IO)has been added, which returns all keys ofioifiois anIOContextand an emptyBase.KeySetotherwise (#37753).countnow accepts an optionalinitargument to control the accumulation type (#37461).- New method
occursin(haystack)that returns a function that checks whether its argument occurs inhaystack(#38475). - New methods
∉(collection),∋(item), and∌(item)returning corresponding containment-testing functions (#38475). - The
nextprodfunction now accepts tuples and other array types for its first argument (#35791). - The
reverse(A; dims)function for multidimensionalAcan now reverse multiple dimensions at once by passing a tuple fordims, and defaults to reversing all dimensions; there is also a multidimensional in-placereverse!(A; dims)(#37367). - The function
isapprox(x,y)now accepts thenormkeyword argument also for numeric (i.e., non-array) argumentsxandy(#35883). ispow2(x)now supports non-Integerargumentsx(#37635).view,@view, and@viewsnow work onAbstractStrings, returning aSubStringwhen appropriate (#35879).- All
AbstractUnitRange{<:Integer}s now work withSubString,view,@viewand@viewson strings (#35879). sum,prod,maximum, andminimumnow supportinitkeyword argument (#36188, #35839).unique(f, itr; seen=Set{T}())now allows you to declare the container type used for keeping track of values returned byfon elements ofitr(#36280).firstandlastfunctions now accept an integer as second argument to get that many leading or trailing elements of any iterable (#34868).CartesianIndicesnow supports step different from1. It can also be constructed from threeCartesianIndexesI,S,JusingI:S:J.stepforCartesianIndicesnow returns aCartesianIndex(#37829).RegexMatchobjects can now be probed for whether a named capture group exists within it throughhaskey()(#36717).- For consistency
haskey(r::RegexMatch, i::Integer)has also been added and returns if the capture group foriexists (#37300).
Standard library changes
- A new standard library
TOMLhas been added for parsing and printing TOML files (#37034). - A new standard library
Downloadshas been added, which replaces the oldBase.downloadfunction withDownloads.download, providing cross-platform, multi-protocol, in-process download functionality implemented with libcurl (#37340). Libdlhas been moved toBase.Libc.Libdl, however it is still accessible as an stdlib (#35628).- To download artifacts lazily,
LazyArtifactsnow must be explicitly listed as a dependency, to avoid needing the support machinery to be available when it is not commonly needed (#37844). - It is no longer possible to create a
LinRange,StepRange, orStepRangeLenwith a<: Integereltype but non-integer step (#32439). intersectonCartesianIndicesnow returnsCartesianIndicesinstead ofVector{<:CartesianIndex}(#36643).push!(c::Channel, v)now returns channelc. Previously, it returned the pushed valuev(#34202).- The composition operator
∘now returns aBase.ComposedFunctioninstead of an anonymous function (#37517). - Logging (such as
@warn) no longer catches exceptions in the logger itself (#36600). @timenow reports if the time presented included any compilation time, which is shown as a percentage (#37678).@varinfocan now report non-exported objects within modules, look recursively into submodules, and return a sorted results table (#38042).@testsetnow supports the optionverboseto show the test result summary of the children even if they all pass (#33755).- In
LinearIndices(::Tuple)andCartesianIndices(::Tuple), integers (as opposed to ranges of integers) in the argument tuple now consistently describe 1-based ranges, e.g,CartesianIndices((3, 1:3))is equivalent toCartesianIndices((1:3, 1:3)). This is how tuples of integers have always been documented to work, but a bug had caused erroneous behaviors with heterogeneous tuples containing both integers and ranges (#37829, #37928).
Package Manager
pkg> precompileis now parallelized through depth-first precompilation of dependencies. Errors will only throw for direct dependencies listed in theProject.toml.pkg> precompileis now automatically triggered whenever Pkg changes the active manifest. Auto-precompilation will remember if a package has errored within the given environment and will not retry until it changes. Auto-precompilation can be gracefully interrupted with actrl-cand disabled by setting the environment variableJULIA_PKG_PRECOMPILE_AUTO=0.- The
Pkg.BinaryPlatformsmodule has been moved intoBaseasBase.BinaryPlatformsand heavily reworked. Applications that want to be compatible with the old API should continue to importPkg.BinaryPlatforms, however new users should useBase.BinaryPlatformsdirectly (#37320). - The
Pkg.Artifactsmodule has been imported as a separate standard library. It is still available asPkg.Artifacts, however starting from Julia v1.6+, packages may import simplyArtifactswithout importing all ofPkgalongside (#37320).
LinearAlgebra
- New method
LinearAlgebra.issuccess(::CholeskyPivoted)for checking whether pivoted Cholesky factorization was successful (#36002). UniformScalingcan now be indexed into using ranges to return dense matrices and vectors (#24359).- New function
LinearAlgebra.BLAS.get_num_threads()for getting the number of BLAS threads (#36360). (+)(::UniformScaling)is now defined, making+Ia valid unary operation (#36784).- Instances of
UniformScalingare no longerisequalto matrices. Previous behaviour violated the rule thatisequal(x, y)implieshash(x) == hash(y). - Transposing
*Triangularmatrices now returns matrices of the opposite triangular type, consistently withadjoint!(::*Triangular)andtranspose!(::*Triangular). Packages containing methods with, e.g.,Adjoint{<:Any,<:LowerTriangular{<:Any,<:OwnMatrixType}}should replace that byUpperTriangular{<:Any,<:Adjoint{<:Any,<:OwnMatrixType}}in the method signature (#38168).
Markdown
Printf
- Complete overhaul of internal code to use the ryu float printing algorithms (from Julia 1.4); leads to consistent 2-5x performance improvements.
- New
Printf.tofloatfunction allowing custom float types to more easily integrate with Printf formatting by converting their type toFloat16,Float32,Float64, orBigFloat. - New
Printf.format"..."andPrintf.Format(...)functions that allow creatingPrintf.Formatobjects that can be passed toPrintf.formatfor easier dynamic printf formatting. Printf.format(f::Printf.Format, args...)as a non-macro function that applies a printf formatfto providedargs.
Random
REPL
-
The
AbstractMenuextension interface ofREPL.TerminalMenushas been extensively overhauled. The new interface does not rely on global configuration variables, is more consistent in delegating printing of the navigation/selection markers, and provides improved support for dynamic menus. These changes are compatible with the previous (deprecated) interface, so are non-breaking.The new API offers several enhancements:
- Menus are configured in their constructors via keyword arguments.
- For custom menu types, the new
ConfigandMultiSelectConfigreplace the globalCONFIGDict. request(menu; cursor=1)allows you to control the initial cursor position in the menu (defaults to first item).MultiSelectMenuallows you to pass a list of initially-selected items with theselectedkeyword argument.writeLinewas deprecated towriteline, andwritelinemethods are not expected to print the cursor indicator. The oldwriteLinecontinues to work, and any of its method extensions should print the cursor indicator as before.printMenuhas been deprecated toprintmenu, and it both accepts a state input and returns a state output that controls the number of terminal lines erased when the menu is next refreshed. This plus related changes makesprintmenuwork properly when the number of menu items might change depending on user choices.numoptions, returning the number of items in the menu, has been added as an alternative to implementingoptions.suppress_output(primarily a testing option) has been added as a keyword argument torequest, rather than a configuration option.
-
Tab completion now supports runs of consecutive sub/superscript characters, e.g.
\^(3)tab-completes to⁽³⁾(#38649). -
Windows REPL now supports 24-bit colors, by correctly interpreting virtual terminal escapes.
SparseArrays
- Display large sparse matrices with a Unicode "spy" plot of their nonzero patterns,
and display small sparse matrices by an
Matrix-like 2d layout of their contents (#33821). - New convenient
spdiagm([m, n,] v::AbstractVector)methods which callspdiagm([m, n,] 0 => v), consistently with their densediagmcounterparts (#37684).
Dates
Quarterperiod is defined (#35519).canonicalizecan now takePeriodas an input (#37391).- Zero-valued
FixedPeriods andOtherPeriods now compare equal, e.g.,Year(0) == Day(0). The behavior of non-zeroPeriods is not changed (#37486).
Statistics
Sockets
Distributed
- Now supports invoking Windows workers via ssh (via new keyword argument
shell=:wincmdinaddprocs) (#30614). - Other new keyword arguments in
addprocs:sshto specify the ssh client path,envto pass environment variables to workers, andcmdline_cookieto work around an ssh problem with Windows workers that run older (pre-ConPTY) versions of Windows, Julia or OpenSSH (#30614).
UUIDs
- Change
uuid1anduuid4to useRandom.RandomDevice()as default random number generator (#35872). - Added
parse(::Type{UUID}, ::AbstractString)method.
Mmap
- On Unix systems, the
Mmap.madvise!function (along with OS-specificMmap.MADV_*constants) has been added to give advice on handling of memory-mapped arrays (#37369).
Deprecated or removed
- The
Base.downloadfunction has been deprecated (silently, by default) in favor of the newDownloads.downloadstandard library function (#37340). - The
Base.Grisucode has been officially removed (float printing was switched to the ryu algorithm code in 1.4). The code is available from JuliaAttic if needed.
External dependencies
Tooling Improvements
Julia v1.5 Release Notes
New language features
- Macro calls
@foo {...}can now also be written@foo{...}(without the space) (#34498). ⨟is now parsed as a binary operator with times precedence. It can be entered in the REPL with\bbsemifollowed by TAB (#34722).±and∓are now unary operators as well, like+or-. Attention has to be paid in macros and matrix constructors, which are whitespace sensitive, because expressions like[a ±b]now get parsed as[a ±(b)]instead of[±(a, b)](#34200).- Passing an identifier
xby itself as a keyword argument or named tuple element is equivalent tox=x, implicitly using the name of the variable as the keyword or named tuple field name. Similarly, passing ana.bexpression usesbas the keyword or field name (#29333). - Support for Unicode 13.0.0 (via utf8proc 2.5) (#35282).
- The compiler optimization level can now be set per-module using the experimental macro
Base.Experimental.@optlevel n. For code that is not performance-critical, setting this to 0 or 1 can provide significant latency improvements (#34896).
Language changes
- The interactive REPL now uses "soft scope" for top-level expressions: an assignment inside a
scope block such as a
forloop automatically assigns to a global variable if one has been defined already. This matches the behavior of Julia versions 0.6 and prior, as well as IJulia. Note that this only affects expressions interactively typed or pasted directly into the default REPL (#28789, #33864). - Outside of the REPL (e.g. in a file), assigning to a variable within a top-level scope
block is considered ambiguous if a global variable with the same name exists.
A warning is given if that happens, to alert you that the code will work differently
than in the REPL.
A new command line option
--warn-scopecontrols this warning (#33864). - Converting arbitrary tuples to
NTuple, e.g.convert(NTuple, (1, ""))now gives an error, where it used to be incorrectly allowed. This is becauseNTuplerefers only to homogeneous tuples (this meaning has not changed) (#34272). - The syntax
(;)(which was deprecated in v1.4) now creates an empty named tuple (#30115). @inlinemacro can now be applied to short-form anonymous functions (#34953).- In triple-quoted string literals, whitespace stripping is now done before processing
escape sequences instead of after. For example, the syntax
used to yield the string " a\nb", since the single space before
""" a\n b"""bset the indent level. Now the result is "a\n b", since the space beforebis no longer considered to occur at the start of a line. The old behavior is considered a bug (#35001). <:and>:can now be broadcasted over arrays with.<:and.>:(#35085)- The line number of function definitions is now added by the parser as an
additional
LineNumberNodeat the start of each function body (#35138). - Statements of the form
a'now get lowered tovar"'"(a)instead ofBase.adjoint(a). This allows for shadowing this function in local scopes, although this is generally discouraged. By default, Base exportsvar"'"as an alias ofBase.adjoint, so custom types should still extendBase.adjoint(#34634).
Compiler/Runtime improvements
- Immutable structs (including tuples) that contain references can now be allocated
on the stack, and allocated inline within arrays and other structs (#33886).
This significantly reduces the number of heap allocations in some workloads.
Code that requires assumptions about object layout and addresses (usually for
interoperability with C or other languages) might need to be updated; for
example any object that needs a stable address should be a
mutable struct. As a result, Arrayviews no longer allocate (#34126).
Command-line option changes
- Deprecation warnings are no longer shown by default. i.e. if the
--depwarn=...flag is not passed it defaults to--depwarn=no. The warnings are printed from tests run byPkg.test()(#35362). - Color now defaults to on when stdout and stderr are TTYs (#34347).
-t N,--threads Nstarts Julia withNthreads. This option takes precedence overJULIA_NUM_THREADS. The specified number of threads also propagates to worker processes spawned using the-p/--procsor--machine-filecommand line arguments. In order to set number of threads for worker processes spawned withaddprocsuse theexeflagskeyword argument, e.g.addprocs(...; exeflags=`--threads 4`)(#35108).
Multi-threading changes
- Parts of the multi-threading API are now considered stable, with caveats.
This includes all documented identifiers from
Base.Threadsexcept theatomic_operations. @threadsnow allows an optional schedule argument. Use@threads :static ...to ensure that the same schedule will be used as in past versions; the default schedule is likely to change in the future.
Build system changes
- The build system now contains a pure-make caching system for expanding expensive operations at the latest possible moment, while still expanding it only once (#35626).
New library functions
- Packages can now provide custom hints to help users resolve errors by using the
experimental
Base.Experimental.register_error_hintfunction. Packages that define custom exception types can support hints by calling theBase.Experimental.show_error_hintsfrom theirshowerrormethod (#35094). - The
@ccallmacro has been added to Base. It is a near drop-in replacement forccallwith more Julia-like syntax. It also wraps the newforeigncallAPI for varargs of different types, though it lacks the capability to specify an LLVM calling convention (#32748). - New functions
mergewithandmergewith!supersedemergeandmerge!withcombineargument. They don't have the restriction forcombineto be aFunctionand also provide one-argument method that returns a closure. The old methods ofmergeandmerge!are still available for backward compatibility (#34296). - The new
isdisjointfunction indicates whether two collections are disjoint (#34427). - Add function
ismutableand deprecateisimmutableto check whether something is mutable (#34652). includenow accepts an optionalmapexprfirst argument to transform the parsed expressions before they are evaluated (#34595).- New function
bitreversefor reversing the order of bits in a fixed-width integer (#34791). - New function
bitrotate(x, k)for rotating the bits in a fixed-width integer (#33937). - New function
contains(haystack, needle)and its one argument partially applied form have been added, it acts likeoccursin(needle, haystack)(#35132). - New function
Base.exit_on_sigintis added to control ifInterruptExceptionis thrown by Ctrl-C (#29411).
New library features
- Function composition now works also on one argument
∘(f) = f(#34251). - One argument methods
startswith(x)andendswith(x)have been added, returning partially-applied versions of the functions, similar to existing methods likeisequal(x)(#33193). isapprox(or≈) now has a one-argument "curried" methodisapprox(x)which returns a function, likeisequal(or==) (#32305).@NamedTuple{key1::Type1, ...}macro for convenientNamedTupledeclarations (#34548).Ref{NTuple{N,T}}can be passed toPtr{T}/Ref{T}ccallsignatures (#34199).x::Signed % Unsignedandx::Unsigned % Signedare supported for integer bitstypes.signed(unsigned_type)is supported for integer bitstypes,unsigned(signed_type)has been supported.accumulate,cumsum, andcumprodnow supportTuple(#34654) and arbitrary iterators (#34656).pop!(collection, key, [default])now has a method forVectorto remove an element at an arbitrary index (#35513).- In
splice!with no replacement, values to be removed can now be specified with an arbitrary iterable (instead of aUnitRange) (#34524). - The
@viewand@viewsmacros now support thea[begin]syntax that was introduced in Julia 1.4 (#35289). openfor files now accepts a keyword argumentlockcontrolling whether file operations will acquire locks for safe multi-threaded access. Setting it tofalseprovides better performance when only one thread will access the file (#35426).- The introspection macros (
@which,@code_typed, etc.) now work withdo-block syntax (#35283) and with dot syntax (#35522). countnow accepts thedimskeyword.- new in-place
count!function similar tosum!. peekis now exported and accepts a type to peek from a stream (#28811).
Standard library changes
- Empty ranges now compare equal, regardless of their startpoint and step (#32348).
- A 1-d
Zipiterator (whereBase.IteratorSizeisBase.HasShape{1}()) with defined length ofnhas now also size of(n,)(instead of throwing an error with truncated iterators) (#29927). - The
@timedmacro now returns aNamedTuple(#34149). - New
supertypes(T)function returns a tuple of all supertypes ofT(#34419). - Views of builtin ranges are now recomputed ranges (like indexing returns) instead of
SubArrays (#26872). - Sorting-related functions such as
sortthat take the keyword argumentslt,rev,orderandbynow do not discardorderifbyorltare passed. In the former case, the order fromorderis used to compare the values ofby(element). In the latter case, any order different fromForwardorReversewill raise an error about the ambiguity. closeon a file (IOStream) can now throw an exception if an error occurs when trying to flush buffered data to disk (#35303).- The large
StridedArrayUnionnow has special printing to avoid printing out its entire contents (#31149).
LinearAlgebra
- The BLAS submodule now supports the level-2 BLAS subroutine
hpmv!(#34211). normalizenow supports multidimensional arrays (#34239).lqfactorizations can now be used to compute the minimum-norm solution to under-determined systems (#34350).sqrt(::Hermitian)now treats slightly negative eigenvalues as zero for nearly semidefinite matrices, and accepts a newrtolkeyword argument for this tolerance (#35057).- The BLAS submodule now supports the level-2 BLAS subroutine
spmv!(#34320). - The BLAS submodule now supports the level-1 BLAS subroutine
rot!(#35124). - New generic
rotate!(x, y, c, s)andreflect!(x, y, c, s)functions (#35124).
Markdown
- In docstrings, a level-1 markdown header "Extended help" is now interpreted as a marker dividing "brief help" from "extended help". The REPL help mode only shows the brief help (the content before the "Extended help" header) by default; prepend the expression with '?' (in addition to the one that enters the help mode) to see the full docstring (#25930).
Random
randn!(::MersenneTwister, ::Array{Float64})is faster, and as a result, for a given state of the RNG, the corresponding generated numbers have changed (#35078).rand!(::MersenneTwister, ::Array{Bool})is faster, and as a result, for a given state of the RNG, the corresponding generated numbers have changed (#33721).- A new faster algorithm ("nearly division less") is used for generating random numbers
within a range (#29240). As a result, the streams of generated numbers are changed
(for ranges, like in
rand(1:9), and for collections in general, like inrand([1, 2, 3])). Also, for performance, the undocumented property that, given a seed anda, bof typeInt,rand(a:b)produces the same stream on 32 and 64 bits architectures, is dropped.
REPL
SparseArrays
lu!acceptsUmfpackLUas an argument to make use of its symbolic factorization.- The
trimkeyword argument for the functionsfkeep!,tril!,triu!,droptol!,dropzeros!anddropzeroshas been removed in favour of always trimming. Calling these withtrim=falsecould result in invalid sparse arrays.
Dates
- The
epsfunction now acceptsTimeTypetypes (#31487). - The
zerofunction now acceptsTimeTypetypes (#35554).
Statistics
Sockets
- Joining and leaving UDP multicast groups on a
UDPSocketis now supported throughjoin_multicast_group()andleave_multicast_group()(#35521).
Distributed
launch_on_machinenow supports and parses ipv6 square-bracket notation (#34430).
Deprecated or removed
External dependencies
- OpenBLAS has been updated to v0.3.9 (#35113).
Tooling Improvements
Julia v1.4 Release Notes
New language features
- Structs with all isbits and isbitsunion fields are now stored inline in arrays (#32448).
importnow allows quoted symbols, e.g.import Base.:+(#33158).a[begin]can now be used to address the first element of an integer-indexed collectiona. The index is computed byfirstindex(a)(#33946).
Language changes
- The syntax
(;), which used to parse as an empty block expression, is deprecated. In the future it will indicate an empty named tuple (#30115).
Multi-threading changes
- Values can now be interpolated into
@asyncand@spawnvia$, which copies the value directly into the constructed underlying closure (#33119).
Build system changes
- Windows build installer has switched to Inno Setup. Installer command line parameters have thus changed. For example, to extract the installer to a specific directory, the command line parameter is now
/DIR=x:\dirname. Usejulia-installer.exe /?to list all new command line parameters.
New library functions
- The new
only(x)function returns the one-and-only element of a collectionx, and throws anArgumentErrorifxcontains zero or multiple elements (#33129). takewhileanddropwhilehave been added to the Iterators submodule (#33437).accumulatehas been added to the Iterators submodule (#34033).- There is a now an
evalpolyfunction meant to take the role of the@evalpolymacro. The function is just as efficient as the macro while giving added flexibility, so it should be preferred over@evalpoly.evalpolytakes a list of coefficients as a tuple, so where one might write@evalpoly(x, p1, p2, p3)one would instead writeevalpoly(x, (p1, p2, p3)).
New library features
- Function composition now supports multiple functions:
∘(f, g, h) = f ∘ g ∘ hand splatting∘(fs...)for composing an iterable collection of functions (#33568). - Functions
gcd,lcm, andgcdxnow supportRationalarguments (#33910). - The
splitpathfunction now accepts anyAbstractStringwhereas previously it only accepted paths of typeString(#33012). filtercan now act on aTuple(#32968).- The
tempnamefunction now takes an optionalparent::AbstractStringargument to give it a directory in which to attempt to produce a temporary path name (#33090). - The
tempnamefunction now takes acleanup::Boolkeyword argument defaulting totrue, which causes the process to try to ensure that any file or directory at the path returned bytempnameis deleted upon process exit (#33090). - The
readdirfunction now takes ajoin::Boolkeyword argument defaulting tofalse, which when set causesreaddirto join its directory argument with each listed name (#33113). divnow accepts a rounding mode as the third argument, consistent with the corresponding argument torem. Support for rounding division, by passing one of the RoundNearest modes to this function, was added. For future compatibility, library authors should now extend this function, rather than extending the two-argumentfld/cld/divdirectly (#33040).methodsnow accepts a module (or a list thereof) to filter methods defined in it (#33403).
Standard library changes
- Calling
showorrepron anundef/UndefInitializer()array initializer now shows valid Julia code (#33211). - Calling
showorrepron a 0-dimensionalAbstractArraynow shows valid code for creating an equivalent 0-dimensional array, instead of only showing the contained value (#33206). readdiroutput is now guaranteed to be sorted. Thesortkeyword allows opting out of sorting to get names in OS-native order (#33542).- The methods of
mktempandmktempdirthat take a function to pass temporary paths to no longer throw errors if the path is already deleted when the function returns (#33091). - Verbose
displayofChar(text/plainoutput) now shows the codepoint value in standard-conforming"U+XXXX"format (#33291). Iterators.partitionnow uses views (or smartly re-computed ranges) for partitions of allAbstractArrays (#33533).- Sets are now displayed less compactly in the REPL, as a column of elements, like vectors and dictionaries (#33300).
delete!onWeakKeyDicts now returns theWeakKeyDictitself instead of the underlyingDictused for implementation
LinearAlgebra
qrandqr!functions supportblocksizekeyword argument (#33053).dotnow admits a 3-argument methoddot(x, A, y)to compute generalized dot productsdot(x, A*y), but without computing and storing the intermediate resultA*y(#32739).ldltand non-pivotedlunow throw a newZeroPivotExceptiontype (#33372).cond(A, p)withp=1orp=Infnow computes the exact condition number instead of an estimate (#33547).UniformScalingobjects may now be exponentiated such that(a*I)^x = a^x * I.
Markdown
- Tables now have the
alignattribute set whenshown as HTML (#33849).
Random
AbstractRNGs now behave like scalars when used in broadcasting (#33213).- The performance of
rand(::Tuple)is improved in some cases (#32208). As a consequence, the stream of generated values produced for a given seed has changed.
REPL
- The attributes of the implicit
IOContextused by the REPL to display objects can be modified by the user (experimental feature) (#29249).
SparseArrays
- The return value of
zero(x::AbstractSparseArray)has no stored zeros anymore (#31835). Previously, it would have stored zeros whereverxhad them. This makes the operation constant time instead ofO(<number of stored values>). - Products involving sparse arrays now allow more general sparse
eltypes, such asStaticArrays(#33205)
Julia v1.3 Release Notes
New language features
- 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).
Language changes
Multi-threading changes
- New experimental
Threads.@spawnmacro 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
IOthat 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
Channelconstructor, which is now easier to read and more idiomatic julia. Use of the keyword argumentscsizeandctypeis now discouraged (#30855, #32818).
Build system changes
New library functions
findfirst,findlast,findnextandfindprevnow 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 wherepatternis a string or regex (#31834). count(pattern, string)gives the number of thingsfindallwould match (#32849).istaskfailedis now documented and exported, like its siblingsistaskdoneandistaskstarted(#32300).RefArrayandRefValueobjects now accept indexCartesianIndex()ingetindexandsetindex!(#32653)- Added
sincosd(x)to simultaneously compute the sine and cosine ofx, wherexis in degrees (#30134). - The function
nonmissingtype, which removesMissingfrom type unions, is now exported (#31562).
Standard library changes
Pkgwon't clobber pre-compilation files as often when switching environments (#32651)Pkgcan now download and install binary artifacts through thePkg.Artifactssubmodule and supporting functions. (#32918)- When
wait(or@sync, orfetch) is called on a failingTask, the exception is propagated as aTaskFailedExceptionwrapping the task. This makes it possible to see the location of the original failure inside the task (as well as the location of thewaitcall, as before) (#32814). Regexcan now be multiplied (*) and exponentiated (^), like strings (#23422).Cmdinterpolation (`$(x::Cmd) a b c`where) now propagatesx's process flags (environment, flags, working directory, etc) ifxis 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,realandimagreturned the unwrapped element when operating over zero-dimensional arrays (#32122). IPAddrsubtypes now behave like scalars when used in broadcasting (#32133).Pairis now treated as a scalar for broadcasting (#32209).clampcan now handle missing values (#31066).emptynow accepts aNamedTuple(#32534).modnow accepts a unit range as the second argument to easily perform offset modular arithmetic to ensure the result is inside the range (#32628).nothingcan now beprinted, 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
openis called with a function, command, and keyword argument (e.g.open(`ls`, read=true) do f ...) it now correctly throws aProcessFailedExceptionlike other similar calls (#32193). mktempandmktempdirnow try, by default, to remove temporary paths they create before the process exits (#32851).- Added argument
keeptounescape_string(#27125).
Libdl
dlopen()can now be invoked indo-block syntax, similar toopen().
LinearAlgebra
- The BLAS submodule no longer exports
dot, which conflicts with that in LinearAlgebra (#31838). diagmandspdiagmnow accept optionalm,ninitial arguments to specify a size (#31654).HessenbergfactorizationsHnow support efficient shifted solves(H+µI) \ band determinants, and use a specialized tridiagonal factorization for Hermitian matrices. There is also a newUpperHessenbergmatrix type (#31853).- Added keyword argument
algtosvdandsvd!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).
SparseArrays
SparseMatrixCSC(m,n,colptr,rowval,nzval)perform consistency checks for arguments:colptrmust be properly populated and lengths ofcolptr,rowval, andnzvalmust be compatible withm,n, andeltype(colptr).sparse(I, J, V, m, n)verifies lengths ofI,J,Vare equal and compatible witheltype(I)andm,n.
Dates
DateTimeandTimeformatting/parsing now supports 12-hour clocks with AM/PM viaIandpcodes, similar tostrftime(#32308).- Fixed
reprsuch that it displaysTimeas it would be entered in Julia (#32103).
Statistics
meannow accepts both a function argument and adimskeyword (#31576).
Sockets
Sockets.recvfromnow returns both host and port as an InetAddr (#32729).- Added
InetAddrconstructor fromAbstractString, representing IP address, andInteger, representing port number (#31459).
Miscellaneous
foldrandmapfoldrnow work on any iterator that supportsIterators.reverse, not just arrays (#31781).
Deprecated or removed
@spawn exprfrom theDistributedstandard library should be replaced with@spawnat :any expr(#32600).Threads.MutexandThreads.RecursiveSpinLockhave been removed; useReentrantLock(preferred) orThreads.SpinLockinstead (#32875).
External dependencies
Tooling Improvements
- The
ClangSA.jlstatic 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.
Julia v1.2 Release Notes
New language features
- Argument splatting (
x...) can now be used in calls to thenewpseudo-function in constructors (#30577). - Support for Unicode 12.0.0 (#31561).
- Added
⋆(\star) as unary operator (#31604).
Language changes
- Empty entries in
JULIA_DEPOT_PATHare now expanded to default depot entries (#31009).
Multi-threading changes
- The
Conditiontype now has a thread-safe replacement, accessed asThreads.Condition. With that addition, task scheduling primitives such asReentrantLockare now thread-safe (#30061). - It is possible to schedule and switch Tasks during
@threadsloops, and perform limited I/O (#31438).
Build system changes
- The build system now prefers downloading prebuilt binary tarballs for most dependencies on
supported systems, disable by setting
USE_BINARYBUILDER=0atmaketime (#31441).
New library functions
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.haspropertyandBase.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). - The new
map!(f, values(::AbstractDict))method allows to modify in-place values of a dictionary (#31223).
Standard library changes
Enumnow behaves like a scalar when used in broadcasting (#30670).- If a
pipelineis specified withappend=trueset, but no redirection, anArgumentErroris thrown, rather than aErrorException(#27900). - Functions that invoke commands (e.g.
run(::Cmd)) now throw aProcessFailedExceptionrather than anErrorException, if those commands exit with non-zero exit code (#27900). - The
extremafunction now accepts a function argument in the same manner asminimumandmaximum(#30323). hasmethodcan now check for matching keyword argument names (#30712).startswithandendswithnow accept aRegexfor the second argument (#29790).retrysupports arbitrary callable objects (#30382).- A no-argument constructor for
Ptr{T}has been added which constructs a null pointer (#30919). stripnow accepts a function argument in the same manner aslstripandrstrip(#31211).mktempdirnow accepts aprefixkeyword argument to customize the file name (#31230, #22922).keytypeandvaltypenow work onAbstractArray, and return theeltypeofkeys(...)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)) == xwhereas previously this could result in a completely different value with a different precision (#31310).mapreducenow accepts multiple iterators, similar tomap(#31532).filternow supportsSkipMissing-wrapped arrays (#31235).- Objects created by calling
skipmissingon an array can now be indexed using indices from the parent at non-missing positions. This allows functions such asfindall,findfirst,argmin/argmaxandfindmin/findmaxto 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).
LinearAlgebra
- Added keyword arguments
rtol,atoltopinvandnullspace(#29998). UniformScalinginstances are now callable such that e.g.I(3)will produce aDiagonalmatrix (#30298).- Eigenvalues λ of general matrices are now sorted lexicographically by (Re λ, Im λ) (#21598).
onefor structured matrices (Diagonal,Bidiagonal,Tridiagonal,Symtridiagonal) now preserves structure and type (#29777).diagm(v)is now a shorthand fordiagm(0 => v)(#31125).
SparseArrays
- 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'whereuandvare sparse vectors or column views (#24980). - The
sprandfunction is now 2 to 5 times faster (#30494). As a consequence of this change, the random stream of matrices produced withsprandandsprandnhas changed.
Sockets
getipaddrsreturns IP addresses in the order provided by libuv (#32260).getipaddrprefers to return the firstIPv4interface address provided by libuv (#32260).
Dates
- Fixed
reprsuch that it displaysDateTimeas it would be entered in Julia (#30200).
Statistics
quantilenow accepts in all cases collections whoseeltypeis not a subtype ofNumber(#30938).
Miscellaneous
- Since environment variables on Windows are case-insensitive,
ENVnow converts its keys to uppercase for display, iteration, and copying (#30593).
External dependencies
- 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).
Julia v1.1 Release Notes
New language features
- 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.@localsreturns a dictionary of current local variable names and values (#29733). - Binary
~can now be dotted, as inx .~ y(#30341).
Language changes
- 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 theCoremodule (#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 aCartesianIndexwhenais a matrix or a higher-dimensional array, for consistency with otherfindallmethods. 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 aCartesianIndexwhenais 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).
Command-line option changes
- 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).
New library functions
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,eachcolandeachslicefunctions provide efficient iterators over slices of arrays (#29749).fieldtypes(T::Type)which returns the declared types of the field in type T (#29600).uuid5has been added to theUUIDsstandard library (#28761).- Predicates
Sys.isfreebsd,Sys.isopenbsd,Sys.isnetbsd, andSys.isdragonflyfor detecting BSD systems have been added (#30249). - Internal
Base.disable_library_threadingthat sets libraries to use one thread. It executes function hooks that have been registered withBase.at_disable_library_threading(#30004).
Standard library changes
CartesianIndicescan now be constructed from twoCartesianIndexesIandJwithI:J(#29440).CartesianIndicessupport 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).
rangecan accept the stop value as a positional argument, e.g.range(1,10,step=2)(#28708).diffnow 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 aBigFloatwith precision equal toprecision(BigFloat)(#29127). The optionalprecisionargument to override the global setting is now a keyword instead of positional argument (#29157). - The use of scientific notation when printing
BigFloatvalues is now consistent with other floating point types (#29211). Regexnow behaves like a scalar when used in broadcasting (#29913).Charnow behaves like a read-only 0-dimensional array (#29819).parsenow allows strings representing integer 0 and 1 for typeBool(#29980).Base.tailnow 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_cmdnow propagates the--inline=(yes|no)flag (#29858).Base.@kwdefcan now be used for parametric structs, and for structs with supertypes (#29316).merge(::NamedTuple, ::NamedTuple...)can now be used with more than 2NamedTuples (#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 thedimsdimension (#28902). rangenow acceptsstopas 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.tomlfile. This also affects the behavior of the--projectcommand line option when using the default--project=@.(#29108).- The
spawnAPI is now more flexible and supports taking IOBuffer directly as an I/O stream, converting to a system pipe as needed (#30278).
Dates
- New
DateTime(::Date, ::Time)constructor (#29754). TimeZonenow behaves like a scalar when used in broadcasting (#30159).
InteractiveUtils
editcan 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).
LinearAlgebra
isdiagandisposdefforDiagonalandUniformScaling(#29638).mul!,rmul!andlmul!methods forUniformScaling(#29506).SymmetricandHermitianmatrices now preserve the wrapper when scaled with a number (#29469).- Exponentiation operator
^now supports raising anIrrationalto anAbstractMatrixpower (#29782). - Added keyword arguments
rtol,atoltorank(#29926).
Random
randpermandrandcyclenow 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). serializeanddeserializenow accept a filename argument, likewriteandread(#30151).
SparseArrays
sprandnnow supports specifying the output element type (#30083).
Statistics
meanandvarnow handle more kinds of empty inputs (#29033).
External dependencies
- 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).
Deprecated or removed
one(i::CartesianIndex)should be replaced withoneunit(i::CartesianIndex)(#29442).- The internal array
Base.Grisu.DIGITSis 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). peakflopshas been scheduled to move fromInteractiveUtilstoLinearAlgebrabut is already now available asLinearAlgebra.peakflops(#29978).
Julia v1.0.0 Release Notes
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.
Standard Library Changes
- The
Libdlmodule's methodsdlopen()anddlsym()have gained athrow_errorkeyword argument, replacing the now-deprecateddlopen_e()anddlsym_e()methods. Whenthrow_errorisfalse, failure to locate a shared library or symbol will returnnothingrather thanC_NULL. (#28888)
Deprecated or removed
- The old package manager (now called
OldPkg) has been moved to a separate repository at https://github.com/JuliaArchive/OldPkg.jl (#27930)
Julia v0.7.0 Release Notes
New language features
-
Local variables can be tested for being defined using the new
@isdefined variablemacro (#22281). -
Destructuring in function arguments: when an expression such as
(x, y)is used as a function argument name, the argument is unpacked into local variablesxandyas in the assignment(x, y) = arg(#6614). -
Named tuples, with the syntax
(a=1, b=2). These behave very similarly to tuples, except components can also be accessed by name using dot syntaxt.a(#22194). -
Keyword argument containers (
kwinf(; kw...)) are now based on named tuples. Dictionary functions likehaskeyand indexing can be used on them, and name-value pairs can be iterated usingpairs(kw).kwcan no longer contain multiple entries for the same argument name (#4916). -
Custom infix operators can now be defined by appending Unicode combining marks, primes, and sub/superscripts to other operators. For example,
+̂ₐ″is parsed as an infix operator with the same precedence as+(#22089). -
The macro call syntax
@macroname[args]is now available and is parsed as@macroname([args])(#23519). -
The construct
if @generated ...; else ...; endcan be used to provide both@generatedand normal implementations of part of a function. Surrounding code will be common to both versions (#23168). -
Added
⟂(\perp) operator with comparison precedence (#24404). -
The
missingsingleton object (of typeMissing) has been added to represent missing values (#24653). It propagates through standard operators and mathematical functions, and implements three-valued logic, similar to SQLsNULLand R'sNA. -
Field access via dot-syntax can now be overloaded by adding methods to
Base.getpropertyandBase.setproperty!(#1974), optionally along with a correspondingBase.propertynamesmethod for reflection (#25311). -
Values for
Enums can now be specified inside of abeginblock when using the@enummacro (#25424). -
Keyword arguments can be required: if a default value is omitted, then an exception is thrown if the caller does not assign the keyword a value (#25830).
-
The pair operator
=>is now broadcastable as.=>which was previously a parsing error (#27447)
Language changes
-
The syntax for parametric methods,
function f{T}(x::T), has been changed tofunction f(x::T) where {T}(#11310). -
The fallback constructor that calls
convertis deprecated. Instead, new types should prefer to define constructors, and addconvertmethods that call those constructors only as necessary (#15120). -
The syntax
1.+2is deprecated, since it is ambiguous: it could mean either1 .+ 2(the current meaning) or1. + 2(#19089). -
Mutable structs with no fields are no longer singletons; it is now possible to make multiple instances of them that can be distinguished by
===(#25854). Zero-size immutable structs are still singletons. -
In string and character literals, backslash
\may no longer precede unrecognized escape characters (#22800). -
Juxtaposing binary, octal, and hexadecimal literals is deprecated, since it can lead to confusing code such as
0xapi == 0xa * pi(#16356). -
Numeric literal juxtaposition now has slightly lower precedence than unary operators, so for example
√2xparses as(√2) * x(#27641). -
Declaring arguments as
x::ANYto avoid specialization has been replaced by@nospecialize x. (#22666).This can also be used in global scope, to apply to all subsequent method definitions in the module (until
@specialize). (#28065) -
Keyword argument default values are now evaluated in successive scopes --- the scope for each expression includes only previous keyword arguments, in left-to-right order (#17240).
-
The parsing of
1<<2*3as1<<(2*3)is deprecated, and will change to(1<<2)*3in a future version (#13079). -
The parsing of
<|is now right associative.|>remains left associative (#24153). -
:now parses like other operators, as a call to a function named:, instead of callingcolon(#25947). -
{ }expressions now usebracesandbracescatas expression heads instead ofcell1dandcell2d, and parse similarly tovectandvcat(#8470). -
Nested
ifexpressions that arise from the keywordelseifnow useelseifas their expression head instead ofif(#21774). -
letblocks now parse the same asforloops; the first argument is either an assignment orblockof assignments, and the second argument is a block of statements (#21774). -
dosyntax now parses to an expression with head:do, instead of as a function call (#21774). -
Parsed and lowered forms of type definitions have been synchronized with their new keywords (#23157). Expression heads are renamed as follows:
-
type=>struct -
bitstype=>primitive(order of arguments is also reversed, to match syntax) -
composite_type=>struct_type -
bits_type=>primitive_type
-
-
The
globalkeyword now only introduces a new binding if one doesn't already exist in the module. This means that assignment to a global (global sin = 3) may now throw the error: "cannot assign variable Base.sin from module Main", rather than emitting a warning. Additionally, the new bindings are now created before the statement is executed. For example,f() = (global sin = "gluttony"; nothing)will now resolve which module containssineagerly, rather than delaying that decision untilfis run. (#22984). -
global constdeclarations may no longer appear inside functions (#12010). -
Uninitialized
BitArrayconstructors of the formBitArray[{N}](shape...)have been deprecated in favor of equivalents acceptingundef(an alias forUndefInitializer()) as their first argument, as inBitArray[{N}](undef, shape...). For example,BitVector(3)is nowBitVector(undef, 3),BitMatrix((2, 4))is nowBitMatrix(undef, (2, 4)), andBitArray{3}(11, 13, 17)is nowBitArray{3}(undef, 11, 14, 17)(#24785). -
Dispatch rules have been simplified: method matching is now determined exclusively by subtyping; the rule that method type parameters must also be captured has been removed. Instead, attempting to access the unconstrained parameters will throw an
UndefVarError. Linting in package tests is recommended to confirm that the set of methods which might throwUndefVarErrorwhen accessing the static parameters (need_to_handle_undef_sparam = Set{Any}(m.sig for m in Test.detect_unbound_args(Base, recursive=true))) is equal (==) to some known set (expected = Set()). (#23117) -
constdeclarations on local variables were previously ignored. They now give a warning, so that this syntax can be disallowed or given a new meaning in a future version (#5148). -
Placing an expression after
catch, as incatch f(x), is deprecated. Usecatch; f(x)instead (#19987). -
In
for i = ..., if a local variableialready existed it would be overwritten during the loop. This behavior is deprecated, and in the futureforloop variables will always be new variables local to the loop (#22314). The old behavior of overwriting an existing variable is available viafor outer i = .... -
In
for i in x,xused to be evaluated in a new scope enclosing theforloop. Now it is evaluated in the scope outside theforloop. -
In
for i in x, j in y, all variables now have fresh bindings on each iteration of the innermost loop. For example, an assignment toiwill not be visible on the nextjloop iteration (#330). -
Variable bindings local to
whileloop bodies are now freshly allocated on each loop iteration, matching the behavior offorloops. -
Prefix
&for by-reference arguments toccallhas been deprecated in favor ofRefargument types (#6080). -
The constructor
Ref(x::T)now always returns aRef{T}(#21527). -
All line numbers in ASTs are represented by
LineNumberNodes; the:lineexpression head is no longer used.QuoteNodes are also consistently used for quoted symbols instead of the:quoteexpression head (though:quoteExprs are still used for quoted expressions) (#23885). -
The
+and-methods forNumberandUniformScalingare not ambiguous anymore since+and-no longer do automatic broadcasting. Hence, the methods forUniformScalingandNumberare no longer deprecated (#23923). -
The keyword
importallis deprecated. Useusingand/or individualimportstatements instead (#22789). -
reduce(+, [...])andreduce(*, [...])no longer widen the iterated over arguments to system word size.sumandprodstill preserve this behavior. (#22825) -
Like
_, variable names consisting only of underscores can be assigned, but accessing their values is deprecated (#24221). -
Raw string literal escaping rules have been changed to make it possible to write all strings. The rule is that backslashes escape both quotes and other backslashes, but only when a sequence of backslashes precedes a quote character. Thus, 2n backslashes followed by a quote encodes n backslashes and the end of the literal while 2n+1 backslashes followed by a quote encodes n backslashes followed by a quote character (#22926).
-
reprmime(mime, x)has been renamed torepr(mime, x), and along withrepr(x)andsprintit now accepts an optionalcontextkeyword forIOContextattributes.stringmimehas been moved to the Base64 stdlib package (#25990). -
The syntax
(x...)for constructing a tuple is deprecated; use(x...,)instead (#24452). -
Non-parenthesized interpolated variables in strings, e.g.
"$x", must be followed by a character that will never be an allowed identifier character (currently operators, space/control characters, or common punctuation characters) (#25231). -
The syntax
using A.Bcan now only be used whenA.Bis a module, and the syntaxusing A: Bcan only be used for adding single bindings (#8000). -
=>now has its own precedence level, giving it strictly higher precedence than=and,(#25391). -
The conditions under which unary operators followed by
(are parsed as prefix function calls have changed (#26154). -
beginis disallowed inside indexing expressions, in order to enable the syntaxa[begin](for selecting the first element) in the future (#23354). -
Underscores for
_italics_and__bold__are now supported by the Base Markdown parser. (#25564) -
…(\dots) and⁝(\tricolon) are now parsed as binary operators (#26262). -
Assignment syntax (
a=b) inside square bracket expressions (e.g.A[...],[x, y]) is deprecated. It will likely be reclaimed in a later version for passing keyword arguments. Note this does not affect updating operators like+=(#25631). -
tryblocks withoutcatchorfinallyare no longer allowed. An explicit emptycatchblock should be written instead (#27554). -
AbstractArraytypes that use unconventional (not 1-based) indexing can now supportsize,length, and@inbounds. To optionally enforce conventional indices, you can@assert !has_offset_axes(A). -
Module pre-compilation is now the default for code loading. Adding a
__precompile__()declaration is no longer necessary, although__precompile__(false)can still be used to opt-out (#26991).
Breaking changes
This section lists changes that do not have deprecation warnings.
-
The package manager
Pkghas been replaced with a new one. See the manual entries on "Code Loading" and "Pkg" for documentation. -
replace(s::AbstractString, pat=>repl)for functionreplarguments formerly passed a substring toreplin all cases. It now passes substrings for string patternspat, but aCharfor character patterns (whenpatis aChar, collection ofChar, or a character predicate) (#25815). -
readuntilnow does not include the delimiter in its result, matching the behavior ofreadline. Passkeep=trueto get the old behavior (#25633). -
lumethods now return decomposition objects such asLUrather than tuples of arrays or tuples of numbers (#26997, #27159, #27212). -
schurmethods now return decomposition objects such asSchurandGeneralizedSchurrather than tuples of arrays (#26997, #27159, #27212). -
lqmethods now return decomposition objects such asLQrather than tuples of arrays (#26997, #27159, #27212). -
qrmethods now return decomposition objects such asQR,QRPivoted, andQRCompactWYrather than tuples of arrays (#26997, #27159, #27212). -
svdmethods now return decomposition objects such asSVDandGeneralizedSVDrather than tuples of arrays or tuples of numbers (#26997, #27159, #27212). -
countlinesnow always counts the last non-empty line even if it does not end with EOL, matching the behavior ofeachlineandreadlines(#25845). -
getindex(s::String, r::UnitRange{Int})now throwsStringIndexErroriflast(r)is not a valid index intos(#22572). -
ntuple(f, n::Integer)throwsArgumentErrorifnis negative. Previously an empty tuple was returned (#21697). -
⋮,⋱,⋰, and⋯are now parsed as binary operators, not ordinary identifiers.≔,≕, and⩴now parse with assignment rather than comparison precedence (#26262). -
Juxtaposing string literals (e.g.
"x"y) is now a syntax error (#20575). -
finalizer(function, object)now returnsobjectrather thannothing(#24679). -
The constructor of
SubStringnow checks if the requested view range is defined by valid indices in the parentAbstractString(#22511). -
Macro calls with
forexpressions are now parsed as generators inside function argument lists (#18650). Examples:-
sum(@inbounds a[i] for i = 1:n)used to give a syntax error, but is now parsed assum(@inbounds(a[i]) for i = 1:n). -
sum(@m x for i = 1:n end)used to parse the argument tosumas a 2-argument call to macro@m, but now parses it as a generator plus a syntax error for the danglingend.
-
-
@__DIR__returns the current working directory rather thannothingwhen not run from a file (#21759). -
@__FILE__and@__DIR__return information relative to the file that it was parsed from, rather than from the task-localSOURCE_PATHglobal when it was expanded. -
All macros receive an extra argument
__source__::LineNumberNodewhich describes the parser location in the source file for the@of the macro call. It can be accessed as a normal argument variable in the body of the macro. This is implemented by inserting an extra leading argument into theExpr(:macrocall, :@name, LineNumberNode(...), args...)surface syntax. (#21746) -
Passing the same keyword argument multiple times is now a syntax error (#16937).
-
getsocknameon aTCPSocketnow returns the locally bound address and port of the socket. Previously the address of the remote endpoint was being returned (#21825). -
The
~/.juliarc.jlfile has been moved to~/.julia/config/startup.jland/etc/julia/juliarc.jlfile has been renamed to/etc/julia/startup.jl(#26161). -
Using
ARGSwithinstartup.jlfiles or within a .jl file loaded with--loadwill no longer contain the script name as the first argument. Instead, the script name will be assigned toPROGRAM_FILE. (#22092) -
The format for a
ClusterManagerspecifying the cookie on the command line is now--worker=<cookie>.--worker <cookie>will not work as it is now an optional argument. -
The representation of
CartesianRangehas changed to a tuple-of-AbstractUnitRanges; thestartandstopfields are no longer present. Usefirst(R)andlast(R)to obtain start/stop. (#20974) -
The
Diagonal,Bidiagonal,TridiagonalandSymTridiagonaltype definitions have changed fromDiagonal{T},Bidiagonal{T},Tridiagonal{T}andSymTridiagonal{T}toDiagonal{T,V<:AbstractVector{T}},Bidiagonal{T,V<:AbstractVector{T}},Tridiagonal{T,V<:AbstractVector{T}}andSymTridiagonal{T,V<:AbstractVector{T}}respectively (#22718, #22925, #23035, #23154). -
The immediate supertype of
BitArrayis now simplyAbstractArray.BitArrayis no longer considered a subtype ofDenseArrayandStridedArray(#25858). -
When called with an argument that contains
NaNelements,findminandfindmaxnow return the firstNaNfound and its corresponding index. Previously,NaNelements were ignored. The new behavior matches that ofmin,max,minimum, andmaximum. -
isapprox(x,y)now testsnorm(x-y) <= max(atol, rtol*max(norm(x), norm(y)))rather thannorm(x-y) <= atol + ..., andrtoldefaults to zero if anatol > 0is specified (#22742). -
Spaces are no longer allowed between
@and the name of a macro in a macro call (#22868). -
Juxtaposition of a non-literal with a macro call (
x@macro) is no longer valid syntax (#22868). -
On a cluster, all files are now loaded from the local file system rather than node 1 (#22588). To load the same file everywhere from node 1, one possible alternative is to broadcast a call to
include_string:@everywhere include_string(Main, $(read("filename", String)), "filename"). Improving upon this API is left as an opportunity for packages. -
randperm(n)andrandcycle(n)now always return aVector{Int}(independent of the type ofn). Use the corresponding mutating functionsrandperm!andrandcycle!to control the array type (#22723). -
Hermitian now ignores any imaginary components in the diagonal instead of checking the diagonal. (#17367)
-
Worker-worker connections are setup lazily for an
:all_to_alltopology. Use keyword arglazy=falseto force all connections to be setup during aaddprocscall. (#22814) -
In
joinpath(a, b)on Windows, if the drive specifications ofaandbdo not match,joinpathnow returnsbinstead of throwing anArgumentError.joinpath(path...)is defined to be left associative, so if any argument has a drive path which does not match the drive of the join of the preceding paths, the prior ones are dropped. (#20912) -
^(A::AbstractMatrix{<:Integer}, p::Integer)now throws aDomainErrorifp < 0, unlessA == one(A)orA == -one(A)(same as for^(A::Integer, p::Integer)) (#23366). -
^(A::AbstractMatrix{<:Integer}, p::Integer)now promotes the element type in the same way as^(A::Integer, p::Integer). This means, for instance, that[1 1; 0 1]^big(1)will return aMatrix{BigInt}instead of aMatrix{Int}(#23366). -
The element type of the input is now preserved in
unique. Previously the element type of the output was shrunk to fit the union of the type of each element in the input. (#22696) -
The
promotefunction now raises an error if its arguments are of different types and if attempting to convert them to a common type fails to change any of their types. This avoids stack overflows in the common case of definitions likef(x, y) = f(promote(x, y)...)(#22801). -
indminandindmaxhave been renamed toargminandargmax, respectively (#25654). -
findmin,findmax,argmin, andargmaxused to always return linear indices. They now returnCartesianIndexes for all but 1-d arrays, and in general return thekeysof indexed collections (e.g. dictionaries) (#22907). -
The
openspecfunlibrary is no longer built and shipped with Julia, as it is no longer used internally (#22390). -
All loaded packages used to have bindings in
Main(e.g.Main.Package). This is no longer the case; now bindings will only exist for packages brought into scope by typingusing Packageorimport Package(#17997). -
The rules for mixed-signedness integer arithmetic (e.g.
Int32(1) + UInt64(1)) have been simplified: if the arguments have different sizes (in bits), then the type of the larger argument is used. If the arguments have the same size, the unsigned type is used (#9292). -
All command line arguments passed via
-e,-E, and-Lwill be executed in the order given on the command line (#23665). -
Inow yieldsUniformScaling{Bool}(true)rather thanUniformScaling{Int64}(1)to better preserve types in operations involvingI(#24396). -
The return type of
reinterprethas changed toReinterpretArray.reinterpreton sparse arrays has been discontinued. -
Base.find_in_pathis nowBase.find_packageorBase.find_source_file(#24320). -
finalizernow takes functions or pointers as its first argument, and the object being finalized as its second (rather than the reverse). For the majority of use cases deprecation warnings will be triggered. However, deprecation warnings will not trigger where (1) the callable argument is not a subtype ofFunction; or (2) both arguments areFunctions orPtr{Cvoid}s (#24605). -
The
killfunction now throws errors on user error (e.g. on permission errors), but returns successfully if the process had previously exited. Its return value has been removed. Use theprocess_runningfunction to determine if a process has already exited. -
The logging system has been redesigned -
infoandwarnare deprecated and replaced with the logging macros@info,@warn,@debugand@error. Theloggingfunction is also deprecated and replaced withAbstractLoggerand the functions from the new standardLogginglibrary. (#24490) -
The
RevStringtype has been removed from the language;reverse(::String)returns aStringwith code points (or fragments thereof) in reverse order. In general,reverse(s)should return a string of the same type and encoding asswith code points in reverse order; any string type overridesreverseto return a different type of string must also overridereverseindto compute reversed indices correctly. -
eachindex(A, B...)now requires that all inputs have the same number of elements. When the chosen indexing is Cartesian, they must have the same axes. -
AbstractRangeobjects are now considered as equal to otherAbstractArrayobjects by==andisequalif all of their elements are equal (#16401). This has required changing the hashing algorithm: ranges now use an O(N) fallback instead of a O(1) specialized method unless they define theBase.RangeStepStyletrait; see its documentation for details. Types which support subtraction (operator-) must now implementwidenfor hashing to work inside heterogeneous arrays. -
findn(x::AbstractArray)has been deprecated in favor offindall(!iszero, x), which now returns cartesian indices for multidimensional arrays (see below, #25532). -
Broadcasting operations are no longer fused into a single operation by Julia's parser. Instead, a lazy
Broadcastedobject is created to represent the fused expression and then realized withcopy(bc::Broadcasted)orcopyto!(dest, bc::Broadcasted)to evaluate the wrapper. Consequently, package authors generally need to specializecopyandcopyto!methods rather thanbroadcastandbroadcast!. This also allows for more customization and control of fused broadcasts. See the Interfaces chapter for more information. -
findhas been renamed tofindall.findall,findfirst,findlast,findnextnow take and/or return the same type of indices askeys/pairsforAbstractArray,AbstractDict,AbstractString,TupleandNamedTupleobjects (#24774, #25545). In particular, this means that they useCartesianIndexobjects for matrices and higher-dimensional arrays instead of linear indices as was previously the case. UseLinearIndices(a)[findall(f, a)]and similar constructs to compute linear indices. -
The
find*functions, i.e.findnext,findprev,findfirst, andfindlast, as well asindexin, now returnnothingwhen no match is found rather than0or0:-1(#25472, #25662, #26149) -
The
Base.HasShapeiterator trait has gained a type parameterNindicating the number of dimensions, which must correspond to the length of the tuple returned bysize(#25655). -
AbstractSetobjects are now considered equal by==andisequalif all of their elements are equal (#25368). This has required changing the hashing algorithm forBitSet. -
the default behavior of
titlecaseis changed in two ways (#23393):- characters not starting a word are converted to lowercase;
a new keyword argument
strictis added which allows to get the old behavior when it'sfalse. - any non-letter character is considered as a word separator;
to get the old behavior (only "space" characters are considered as
word separators), use the keyword
wordsep=isspace.
- characters not starting a word are converted to lowercase;
a new keyword argument
-
writedlmin the standard library module DelimitedFiles now writes numeric values usingprintrather thanprint_shortest(#25745). -
The
tempnamefunction used to create a file on Windows but not on other platforms. It now never creates a file (#9053). -
The
fieldnamesandpropertynamesfunctions now return a tuple rather than an array (#25725). -
indexinnow returns the first rather than the last matching index (#25998). -
parse(::Type, ::Char)now uses a default base of 10, like other number parsing methods, instead of 36 (#26576). -
isequalforPtrs now compares element types;==still compares only addresses (#26858). -
widenon 8- and 16-bit integer types now widens to 16- and 32-bit types, respectively. (#28045). -
mv,cp,touch,mkdir,mkpath,chmodandchownnow return the path that was created/modified rather thannothing(#27071). -
Regular expressions now default to UCP mode. Escape sequences such as
\wwill now match based on unicode character properties, e.g.r"\w+"will matchcafé(not justcaf). Add theamodifier (e.g.r"\w+"a) to restore the previous behavior (#27189). -
@syncnow waits only for lexically enclosed (i.e. visible directly in the source text of its argument)@asyncexpressions. If you need to wait for a task created by a called functionf, havefreturn the task and put@async wait(f(...))within the@syncblock. This change makes@scheduleredundant with@async, so@schedulehas been deprecated (#27164). -
norm(A::AbstractMatrix, p=2)computes no longer the operator/matrix norm but thenormofAas for other iterables, i.e. as if it were a vector. Especially,norm(A::AbstractMatrix)is the Frobenius norm. To compute the operator/matrix norm, use the new functionopnorm(#27401). -
dot(u, v)now acts recursively. Instead ofsum(u[i]' * v[i] for i in ...), it computessum(dot(u[i], v[i]) for i in ...), similarly tovecdotbefore (#27401). -
Sys.CPU_COREShas been renamed toSys.CPU_THREADS; it still gives the number of "logical cores" (including hyperthreading) rather than the number of physical cores present on the CPU. Similarly, the environment variableJULIA_CPU_CORESis deprecated in favor ofJULIA_CPU_THREADS(#27856). -
WeakKeyDictdoes not convert keys on insertion anymore (#24941).
Library improvements
-
The function
thisind(s::AbstractString, i::Integer)returns the largest valid index less or equal thaniin the stringsor0if no such index exists (#24414). -
Support for Unicode 11 (#28266).
-
Charis now a subtype ofAbstractChar, and most of the functions that take character arguments now accept anyAbstractChar(#26286). -
pathof(module)returns the path a module was imported from (#28310). -
bytes2hexnow accepts an optionalioargument to output to a hexadecimal stream without allocating aStringfirst (#27121). -
String(array)now accepts an arbitraryAbstractVector{UInt8}. ForVectorinputs, it "steals" the memory buffer, leaving them with an empty buffer which is guaranteed not to be shared with theStringobject. For other types of vectors (in particular immutable vectors), a copy is made and the input is not truncated (#26093). -
Irrationalis now a subtype ofAbstractIrrational(#24245). -
Introduced the
emptyfunction, the functional pair toempty!which returns a new, empty container (#24390). -
Jump to first/last history entries in the REPL via "Alt-<" and "Alt->" (#22829).
-
REPL LaTeX-like tab completions have been simplified for several Unicode characters, e.g.
𝔸is now\bbArather than\BbbA(#25980). -
The function
chopnow accepts two argumentsheadandtailallowing to specify number of characters to remove from the head and tail of the string (#24126). -
get(io, :color, false)can now be used to query whether a streamiosupports ANSI color codes (#25067), rather than using the undocumentedBase.have_colorglobal flag. -
print_with_colorhas been deprecated in favor ofprintstyled([io], xs...; bold=false, color=:normal)for printing styled text (#25522). -
Functions
firstandlastnow acceptncharargument forAbstractString. If this argument is used they return a string consisting of first/lastncharcharacters from the original string (#23960). -
Expressions
x^-nwherenis an integer literal now correspond toinv(x)^n. For example,x^-1is now essentially a synonym forinv(x), and works in a type-stable way even iftypeof(x) != typeof(inv(x))(#24240). -
New
Iterators.reverse(itr)for reverse-order iteration (#24187). Iterator typesTcan implementstartetc. forIterators.Reverse{T}to support this. -
The functions
nextindandprevindnow acceptncharargument that indicates the number of characters to move (#23805). -
The functions
strip,lstripandrstripnow returnSubString(#22496). -
The functions
strwidthandcharwidthhave been merged intotextwidth(#20816). -
The functions
baseanddigitsdigits now accept a negative base (likendigitsdid) (#21692). -
The function
randnnow accepts complex arguments (Complex{T <: AbstractFloat}) (#21973). -
parse(Complex{T}, string)can parse complex numbers in some common formats (#24713). -
The function
randcan now pick up random elements from strings, associatives and sets (#22228, #21960, #18155, #22224). -
It's now possible to specify the characters to pick from in the
randstringfunction (#22222). -
Allow multidimensional arrays in
shuffleandshuffle!functions (#22226). -
Method lists are now printed as a numbered list. In addition, the source code of a method can be opened in an editor by entering the corresponding number in the REPL and pressing
^Q(#22007). -
getpeernameon aTCPSocketreturns the address and port of the remote endpoint of the TCP connection (#21825). -
resize!andsizehint!methods no longer over-reserve memory when the requested array size is more than double of its current size (#22038). -
The
crc32cfunction for CRC-32c checksums is now exported (#22274). -
eye(::Type{Diagonal{T}}, m::Integer)has been deprecated in favor ofDiagonal{T}(I, m)(#24415). -
The output of
versioninfois now controlled with keyword arguments (#21974). -
The function
LibGit2.set_remote_urlnow always sets both the fetch and push URLs for a git repo. Additionally, the argument order was changed to be consistent with the git command line tool (#22062). -
Added
unique!which is an inplace version ofunique(#20549). -
@test isequal(x, y)and@test isapprox(x, y)now prints an evaluated expression when the test fails (#22296). -
Uses of
Val{c}inBasehas been replaced withVal{c}(), which is now easily accessible via the efficient constructorVal(c). Functions are defined asf(::Val{c}) = ...and called byf(Val(c)). Notable affected functions include:ntuple,Base.literal_pow,sqrtm,lufact,lufact!,qrfact,qrfact!,cholfact,cholfact!,_broadcast!,reshape,catandcat_t. -
A new
@macroexpand1macro for non recursive macro expansion (#21662). -
Chars can now be concatenated withStrings and/or otherChars using*(#22532). -
Diagonal,Bidiagonal,TridiagonalandSymTridiagonalare now parameterized on the type of the wrapped vectors, allowingDiagonal,Bidiagonal,TridiagonalandSymTridiagonalmatrices with arbitraryAbstractVectors (#22718, #22925, #23035, #23154). -
Mutating versions of
randpermandrandcyclehave been added:randperm!andrandcycle!(#22723). -
BigFloatrandom numbers can now be generated (#22720). -
The efficiency of random generation for MersenneTwister RNGs has been improved for integers,
Float64and ranges; as a result, given a seed, the produced stream of numbers has changed (#27560, #25277, #25197, #25058, #25047). -
REPL Undo via Ctrl-/ and Ctrl-_
-
diagmnow accepts several diagonal index/vectorPairs (#24047). -
isequal,==, andinhave one argument "curried" forms. For exampleisequal(x)returns a function that compares its argument toxusingisequal(#26436). -
reinterpretnow works on any AbstractArray using the newReinterpretArraytype. This supersedes the old behavior of reinterpret on Arrays. As a result, reinterpreting arrays with different alignment requirements (removed in 0.6) is once again allowed (#23750). -
The
keysof anAssociativeare now anAbstractSet.Base.KeyIterator{<:Associative}has been changed toKeySet{K, <:Associative{K}} <: AbstractSet{K}(#24580). -
New function
ncodeunits(s::AbstractString)gives the number of code units in a string. The generic definition is constant time but callslastindex(s)which may be inefficient. Therefore custom string types may want to define directncodeunitsmethods. -
reverseind(s::AbstractString, i::Integer)now has an efficient generic fallback, so custom string types do not need to provide their own efficient definitions. The generic definition relies onncodeunitshowever, so for optimal performance you may need to define a custom method for that function. -
The global RNG is being re-seeded with its own seed at the beginning of each
@testset, and have its original state restored at the end (#24445). This is breaking for testsets relying implicitly on the global RNG being in a specific state. -
permutedims(m::AbstractMatrix)is now short forpermutedims(m, (2,1)), and is now a more convenient way of making a "shallow transpose" of a 2D array. This is the recommended approach for manipulating arrays of data, rather than the recursively defined, linear-algebra functiontranspose. Similarly,permutedims(v::AbstractVector)will create a row matrix (#24839). -
A new
replace(A, old=>new)function is introduced to replaceoldbynewin collectionA. There is also another method with a different API, and a mutating variant,replace!(#22324, #25697, #26206, #27944). -
Adding integers to
CartesianIndexobjects is now deprecated. Instead ofi::Int + x::CartesianIndex, usei*one(x) + x(#26284). -
CartesianRangechanges (#24715):- Inherits from
AbstractArray, and linear indexing can be used to provide linear-to-cartesian conversion (#24715) - It has a new constructor taking an array
- Inherits from
-
several missing set-like operations have been added (#23528):
union,intersect,symdiff,setdiffare now implemented for all collections with arbitrary many arguments, as well as the mutating counterparts (union!etc.). The performance is also much better in many cases. Note that this change is slightly breaking: all the non-mutating functions always return a new object even if only one argument is passed. Moreover the semantics ofintersectandsymdiffis changed for vectors:intersectdoesn't preserve the multiplicity anymore (usefilterfor the old behavior)symdiffhas been made consistent with the corresponding methods for other containers, by taking the multiplicity of the arguments into account. Useuniqueto get the old behavior.
-
The
linearindicesfunction has been deprecated in favor of the newLinearIndicestype, which additionally provides conversion from cartesian indices to linear indices using the normal indexing operation. (#24715, #26775). -
IdDict{K,V}replacesObjectIdDict. It has type parameters like otherAbstractDictsubtypes and its constructors mirror the ones ofDict. (#25210) -
IOBuffercan take thesizehintkeyword argument to suggest a capacity of the buffer (#25944). -
lstripandrstripnow accept a predicate function that defaults toisspace(#27309). -
trunc,floor,ceil, androundspecifydigits,sigdigitsandbaseusing keyword arguments. (#26156, #26670) -
Sys.which()provides a cross-platform method to find executable files, similar to the Unixwhichcommand. (#26559) -
Added an optimized method of
vecdotfor taking the Frobenius inner product of sparse matrices. (#27470) -
Added an optimized method of
kronfor taking the tensor product of twoDiagonalmatrices. ([27581]) -
An official API for extending
randis now defined (#23964, #25002). -
The constructor
MersenneTwister()is re-enabled, producing a randomly initialized RNG (similar toRandom.seed!(MersenneTwister(0))) (#21909). -
BitSetcan now store anyInt(instead of only positive ones) (#25029). -
The initial element
v0inreduce(op, v0, itr)has been replaced with aninitoptional keyword argument, as inreduce(op, itr; init=v0). Similarly forfoldl,foldr,mapreduce,mapfoldl,mapfoldr,accumulateandaccumulate!. (#27711, #27859)
Compiler/Runtime improvements
-
The inlining heuristic now models the approximate runtime cost of a method (using some strongly-simplifying assumptions). Functions are inlined unless their estimated runtime cost substantially exceeds the cost of setting up and issuing a subroutine call. (#22210, #22732)
-
Inference recursion-detection heuristics are now more precise, allowing them to be triggered less often, but being more aggressive when they are triggered to drive the inference computation to a solution (#23912).
-
Inference now propagates constants inter-procedurally, and can compute various constants expressions at compile-time (#24362).
-
The LLVM SLP Vectorizer optimization pass is now enabled at the default optimization level.
Deprecated or removed
-
The
JULIA_HOMEenvironment variable has been renamed toJULIA_BINDIRandBase.JULIA_HOMEhas been moved toSys.BINDIR(#20899). -
The keyword
immutableis fully deprecated tostruct, andtypeis fully deprecated tomutable struct(#19157, #20418). -
lufact,schurfact,lqfact,qrfact,ldltfact,svdfact,bkfact,hessfact,eigfact, andcholfacthave respectively been deprecated tolu,schur,lq,qr,ldlt,svd,bunchkaufman,hessenberg,eigen, andcholesky(#26997, #27159, #27212). -
lufact!,schurfact!,lqfact!,qrfact!,ldltfact!,svdfact!,bkfact!,hessfact!, andeigfact!have respectively been deprecated tolu!,schur!,lq!,qr!,ldlt!,svd!,bunchkaufman!,hessenberg!, andeigen!(#26997, #27159, #27212). -
eig(A[, args...])has been deprecated in favor ofeigen(A[, args...]). Whereas the former returns a tuple of arrays, the latter returns anEigenobject. So for a direct replacement, use(eigen(A[, args...])...,). But going forward, consider using the direct result ofeigen(A[, args...])instead, either destructured into its components (vals, vecs = eigen(A[, args...])) or as anEigenobject (X = eigen(A[, args...])) (#26997, #27159, #27212). -
eig(A::AbstractMatrix, B::AbstractMatrix)andeig(A::Number, B::Number)have been deprecated in favor ofeigen(A, B). Whereas the former each return a tuple of arrays, the latter returns aGeneralizedEigenobject. So for a direct replacement, use(eigen(A, B)...,). But going forward, consider using the direct result ofeigen(A, B)instead, either destructured into its components (vals, vecs = eigen(A, B)), or as aGeneralizedEigenobject (X = eigen(A, B)) (#26997, #27159, #27212). -
ordschur(T::StridedMatrix{Ty}, Z::StridedMatrix{Ty}, select::Union{Vector{Bool},BitVector})andordschur(S::StridedMatrix{Ty}, T::StridedMatrix{Ty}, Q::StridedMatrix{Ty}, Z::StridedMatrix{Ty}, select::Union{Vector{Bool},BitVector})and their respective inplace versions have been deprecated. Useordschur(schur::Schur, select::Union{Vector{Bool},BitVector})andordschur(gschur::GeneralizedSchur, select::Union{Vector{Bool},BitVector})instead (#28155). -
Indexing into multidimensional arrays with more than one index but fewer indices than there are dimensions is no longer permitted when those trailing dimensions have lengths greater than 1. Instead, reshape the array or add trailing indices so the dimensionality and number of indices match (#14770, #23628).
-
The use of a positional dimension argument has largely been deprecated in favor of a
dimskeyword argument. This includes the functionssum,prod,maximum,minimum,all,any,findmax,findmin,mean,varm,std,var,cov,cor,median,mapreducedim,reducedim,sort,accumulate,accumulate!,cumsum,cumsum!,cumprod,cumprod!,flipdim,dropdims, andcat(#25501, #26660, #27100). -
indices(a)andindices(a,d)have been deprecated in favor ofaxes(a)andaxes(a, d)(#25057). -
EnvHashhas been renamed toEnvDict(#24167). -
Uninitialized
Arrayconstructors of the formArray[{T,N}](shape...)have been deprecated in favor of equivalents acceptingundef(an alias forUndefInitializer()) as their first argument, as inArray[{T,N}](undef, shape...). For example,Vector(3)is nowVector(undef, 3),Matrix{Int}((2, 4))is now,Matrix{Int}(undef, (2, 4)), andArray{Float32,3}(11, 13, 17)is nowArray{Float32,3}(undef, 11, 13, 17)(#24781). -
Previously
setindex!(A, x, I...)(and the syntaxA[I...] = x) supported two different modes of operation when supplied with a set of non-scalar indicesI(e.g., at least one index is anAbstractArray) depending upon the value ofxon the right hand side. Ifxis anAbstractArray, its contents are copied elementwise into the locations inAselected byIand it must have the same number of elements asIselects locations. Otherwise, ifxis not anAbstractArray, then its value is implicitly broadcast to all locations to all locations inAselected byI. This latter behavior—implicitly broadcasting "scalar"-like values across many locations—is now deprecated in favor of explicitly using the broadcasted assignment syntaxA[I...] .= xorfill!(view(A, I...), x)(#26347). -
broadcast_getindex(A, I...)andbroadcast_setindex!(A, v, I...)are deprecated in favor ofgetindex.((A,), I...)andsetindex!.((A,), v, I...), respectively (#27075). -
LinAlg.fillslots!has been renamedLinAlg.fillstored!(#25030). -
fill!(A::Diagonal, x)andfill!(A::AbstractTriangular, x)have been deprecated in favor ofBase.LinAlg.fillstored!(A, x)(#24413). -
eyehas been deprecated in favor ofIandMatrixconstructors. Please see the deprecation warnings for replacement details (#24438). -
zeros(D::Diagonal[, opts...])has been deprecated (#24654). -
Using Bool values directly as indices is now deprecated and will be an error in the future. Convert them to
Intbefore indexing if you intend to access index1fortrueand0forfalse. -
slicedim(A, d, i)has been deprecated in favor ofcopy(selectdim(A, d, i)). The newselectdimfunction now always returns a view intoA; in many cases thecopyis not necessary. Previously,slicedimon a vectorVover dimensiond=1and scalar indexiwould return the just selected element (unlessVwas aBitVector). This has now been made consistent:selectdimnow always returns a view into the original array, with a zero-dimensional view in this specific case (#26009). -
whoshas been renamedvarinfo, and now returns a markdown table instead of printing output (#12131). -
Uninitialized
RowVectorconstructors of the formRowVector{T}(shape...)have been deprecated in favor of equivalents acceptingundef(an alias forUndefInitializer()) as their first argument, as inRowVector{T}(undef, shape...). For example,RowVector{Int}(3)is nowRowVector{Int}(undef, 3), andRowVector{Float32}((1, 4))is nowRowVector{Float32}(undef, (1, 4))(#24786). -
writecsv(io, a; opts...)has been deprecated in favor ofwritedlm(io, a, ','; opts...)(#23529). -
The method
srand(rng, filename, n=4)has been deprecated (#21359). -
readcsv(io[, T::Type]; opts...)has been deprecated in favor ofreaddlm(io, ','[, T]; opts...)(#23530). -
sparse(s::UniformScaling, m::Integer)has been deprecated in favor of the three-argument equivalentsparse(s::UniformScaling, m, n)(#24472). -
The
cholfact/cholfact!methods that accepted anuplosymbol have been deprecated in favor of usingHermitian(orSymmetric) views (#22187, #22188). -
The
thinkeyword argument for orthogonal decomposition methods has been deprecated in favor offull, which has the opposite meaning:thin == trueif and only iffull == false(#24279). -
isposdef(A::AbstractMatrix, UL::Symbol)andisposdef!(A::AbstractMatrix, UL::Symbol)have been deprecated in favor ofisposdef(Hermitian(A, UL))andisposdef!(Hermitian(A, UL))respectively (#22245). -
The
bkfact/bkfact!methods that accepteduploandissymmetricsymbols have been deprecated in favor of usingHermitian(orSymmetric) views (#22605). -
The function
current_moduleis deprecated and replaced with@__MODULE__. This caused the deprecation of some reflection methods (such asmacroexpandandisconst), which now require a module argument. And it caused the bugfix of other default arguments to use the Main module (includingwhos,which) (#22064). -
expand(ex)andexpand(module, ex)have been deprecated in favor ofMeta.lower(module, ex)(#22064, #24278). -
ones(A::AbstractArray[, opts...])andzeros(A::AbstractArray[, opts...])methods have been deprecated. Forzeros(A), considerzero(A). Forones(A)orzeros(A), considerones(size(A)),zeros(size(A)),fill(v, size(A))forvan appropriate one or zero,fill!(copy(A), {1|0}),fill!(similar(A), {1|0}), or any of the preceding with different element type and/or shape depending onopts.... Where strictly necessary, considerfill!(similar(A[, opts...]), {one(eltype(A)) | zero(eltype(A))}). For an algebraic multiplicative identity, considerone(A)(#24656). -
The
similar(dims->f(..., dims...), [T], axes...)method to add offset array support to a functionfthat would otherwise create a non-offset array has been deprecated. Instead, callf(..., axes...)directly and, if needed, the offset array implementation should add offset axis support to the functionfdirectly (#26733). -
The functions
onesandzerosused to accept any objects as dimensional arguments, implicitly converting them toInts. This is now deprecated; onlyIntegers orAbstractUnitRanges are accepted as arguments. Instead, convert the arguments before callingonesorzeros(#26733). -
The variadic
size(A, dim1, dim2, dims...)method to return a tuple of multiple dimension lengths ofAhas been deprecated (#26862). -
The
Operatorsmodule is deprecated. Instead, import required operators explicitly fromBase, e.g.import Base: +, -, *, /(#22251). -
Bindings to the FFTW library have been removed from Base. The DFT framework for building FFT implementations is now in AbstractFFTs.jl, the bindings to the FFTW library are in FFTW.jl, and the Base signal processing functions which used FFTs are now in DSP.jl (#21956).
-
The
correctedpositional argument tocovhas been deprecated in favor of a keyword argument with the same name (#21709). -
Omitting spaces around the
?and the:tokens in a ternary expression has been deprecated. Ternaries must now include some amount of whitespace, e.g.x ? a : brather thanx?a:b(#22523 and #22712). -
?can no longer be used as an identifier name (#22712) -
The method
replace(s::AbstractString, pat, r, [count])is deprecated in favor ofreplace(s::AbstractString, pat => r; [count])(#25165). Moreover,countcannot be negative anymore (usetypemax(Int)instead (#22325). -
read(io, type, dims)is deprecated toread!(io, Array{type}(undef, dims))(#21450). -
read(::IO, ::Ref)is now a method ofread!, since it mutates itsRefargument (#21592). -
nb_availableis nowbytesavailable(#25634). -
skipchars(io::IO, predicate; linecomment=nothing)is deprecated in favor ofskipchars(predicate, io::IO; linecomment=nothing)(#25667). -
Bidiagonalconstructors now use aSymbol(:Uor:L) for the upper/lower argument, instead of aBoolor aChar(#22703). -
Bidiagonal,TridiagonalandSymTridiagonalconstructors that automatically converted the input vectors to the same type are deprecated in favor of explicit conversion (#22925, #23035, #23154. -
Calling
nfieldson a type to find out how many fields its instances have is deprecated. Usefieldcountinstead. Usenfieldsonly to get the number of fields in a specific object (#22350). -
fieldnamesnow operates only on types. To get the names of fields in an object, usefieldnames(typeof(x))(#22350). -
InexactError,DomainError, andOverflowErrornow take arguments.InexactError(func::Symbol, type, -3)now prints as "ERROR: InexactError: func(type, -3)",DomainError(val, [msg])prints as "ERROR: DomainError with val:\nmsg", andOverflowError(msg)prints as "ERROR: OverflowError: msg". (#20005, #22751, #22761) -
The operating system identification functions:
is_linux,is_bsd,is_apple,is_unix, andis_windows, have been deprecated in favor ofSys.islinux,Sys.isbsd,Sys.isapple,Sys.isunix, andSys.iswindows, respectively (#22182). -
The forms of
read,readstring, andeachlinethat accepted both aCmdobject and an input stream are deprecated. Use e.g.read(pipeline(stdin, cmd))instead (#22762). -
The unexported type
AbstractIOBufferhas been renamed toGenericIOBuffer(#17360 #22796). -
IOBuffer(data::AbstractVector{UInt8}, read::Bool, write::Bool, maxsize::Integer),IOBuffer(read::Bool, write::Bool), andIOBuffer(maxsize::Integer)are deprecated in favor of constructors taking keyword arguments (#25872). -
Displayhas been renamed toAbstractDisplay(#24831). -
Remaining vectorized methods over
SparseVectors, particularlyfloor,ceil,trunc,round, and most common transcendental functions such asexp,log, andsinvariants, have been deprecated in favor of dot-syntax (#22961). -
The method
String(io::IOBuffer)is deprecated toString(take!(copy(io)))(#21438). -
The function
readstringis deprecated in favor ofread(io, String)(#22793) -
The function
showallis deprecated. Showing entire values is the default, unless anIOContextspecifying:limit=>trueis in use (#22847). -
issubtypehas been deprecated in favor of<:(which used to be an alias forissubtype). -
Calling
writeon non-isbits arrays is deprecated in favor of explicit loops orserialize(#6466). -
The default
startup.jlfile on Windows has been removed. Now must explicitly include the full path if you need access to executables or libraries in theSys.BINDIRdirectory, e.g.joinpath(Sys.BINDIR, "7z.exe")for7z.exe(#21540). -
sqrtmhas been deprecated in favor ofsqrt(#23504). -
expmhas been deprecated in favor ofexp(#23233). -
logmhas been deprecated in favor oflog(#23505). -
fullhas been deprecated in favor of more specific, better defined alternatives. On structured matricesA, consider insteadMatrix(A),Array(A),SparseMatrixCSC(A), orsparse(A). On sparse arraysS, consider insteadVector(S),Matrix(S), orArray(S)as appropriate. On factorizationsF, consider insteadMatrix(F),Array(F),AbstractMatrix(F), orAbstractArray(F). On implicit orthogonal factorsQ, consider insteadMatrix(Q)orArray(Q); for implicit orthogonal factors that can be recovered in square or truncated form, see the deprecation message for square recovery instructions. OnSymmetric,Hermitian, orAbstractTriangularmatricesA, consider insteadMatrix(S),Array(S),SparseMatrixCSC(S), orsparse(S). OnSymmetricmatricesAparticularly, consider insteadLinAlg.copytri!(copy(parent(A)), A.uplo). OnHermitianmatricesAparticularly, consider insteadLinAlg.copytri!(copy(parent(A)), A.uplo, true). OnUpperTriangularmatricesAparticularly, consider insteadtriu!(copy(parent(A))). OnLowerTriangularmatricesAparticularly, consider insteadtril!(copy(parent(A)))(#24250). -
speyehas been deprecated in favor ofI,sparse, andSparseMatrixCSCconstructor methods (#24356). -
Calling
unionwith no arguments is deprecated; construct an empty set with an appropriate element type usingSet{T}()instead (#23144). -
Vectorized
DateTime,Date, andformatmethods have been deprecated in favor of dot-syntax (#23207). -
Base.cpadhas been removed; use an appropriate combination ofrpadandlpadinstead (#23187). -
ctransposeandctranspose!have been deprecated in favor ofadjointandadjoint!, respectively (#23235). -
filterandfilter!on dictionaries now pass a singlekey=>valuepair to the argument function, instead of two arguments (#17886). -
rol,rol!,ror, andror!have been deprecated in favor of specialized methods forcircshift/circshift!(#23404). -
Base.SparseArrays.SpDiagIteratorhas been removed (#23261). -
The function
cfunction, has been deprecated in favor of a macro form@cfunction. Most existing uses can be upgraded simply by adding a@. The new syntax now additionally supports allocating closures at runtime, for dealing with C APIs that don't provide a separatevoid* env-type callback argument. (#26486) -
diagm(v::AbstractVector, k::Integer=0)has been deprecated in favor ofdiagm(k => v)(#24047). -
diagm(x::Number)has been deprecated in favor offill(x, 1, 1)(#24047). -
diagm(A::SparseMatrixCSC)has been deprecated in favor ofspdiagm(sparsevec(A))(#23341). -
diagm(A::BitMatrix)has been deprecated, usediagm(0 => vec(A))orBitMatrix(Diagonal(vec(A)))instead (#23373, #24047). -
ℯ(written as\mscre<TAB>or\euler<TAB>) is now the only (by default) exported name for Euler's number, and the type has changed fromIrrational{:e}toIrrational{:ℯ}(#23427). -
The mathematical constants
π,pi,ℯ,e,γ,eulergamma,catalan,φandgoldenhave been moved fromBaseto a new module;Base.MathConstants. Onlyπ,piandℯare now exported by default fromBase(#23427). -
eu(previously an alias forℯ) has been deprecated in favor ofℯ(orMathConstants.e) (#23427). -
GMP.gmp_version(),GMP.GMP_VERSION,GMP.gmp_bits_per_limb(), andGMP.GMP_BITS_PER_LIMBhave been renamed toGMP.version(),GMP.VERSION,GMP.bits_per_limb(), andGMP.BITS_PER_LIMB, respectively. Similarly,MPFR.get_version(), has been renamed toMPFR.version()(#23323). Also,LinAlg.LAPACK.laver()has been renamed toLinAlg.LAPACK.version()and now returns aVersionNumber. -
select,select!,selectpermandselectperm!have been renamed respectively topartialsort,partialsort!,partialsortpermandpartialsortperm!(#23051). -
The
Rangeabstract type has been renamed toAbstractRange(#23570). -
mapon dictionaries previously operated onkey=>valuepairs. This behavior is deprecated, and in the futuremapwill operate only on values (#5794). -
mapon sets previously returned aSet, possibly changing the order or number of elements. This behavior is deprecated and in the futuremapwill preserve order and number of elements (#26980). -
Previously, broadcast defaulted to treating its arguments as scalars if they were not arrays. This behavior is deprecated, and in the future
broadcastwill default to iterating over all its arguments. Wrap arguments you wish to be treated as scalars withRef()or a 1-tuple. Package developers can choose to allow a non-iterable typeTto always behave as a scalar by implementingbroadcastable(x::T) = Ref(x)(#26212). -
Automatically broadcasted
+and-forarray + scalar,scalar - array, and so-on have been deprecated due to inconsistency with linear algebra. Use.+and.-for these operations instead (#22880, #22932). -
flipbits!(B)is deprecated in favor of using in-place broadcast to negate each element:B .= .!B(#27067). -
isleaftypeis deprecated in favor of the simpler predicatesisconcretetypeandisdispatchtuple. Concrete types are those that might equaltypeof(x)for somex;isleaftypeincluded some types for which this is not true. Those are now categorized more precisely as "dispatch tuple types" and "!has_free_typevars" (not exported). (#17086, #25496) -
contains(eq, itr, item)is deprecated in favor ofanywith a predicate (#23716). -
spdiagm(x::AbstractVector)has been deprecated in favor ofsparse(Diagonal(x))alternativelyspdiagm(0 => x)(#23757). -
spdiagm(x::AbstractVector, d::Integer)andspdiagm(x::Tuple{<:AbstractVector}, d::Tuple{<:Integer})have been deprecated in favor ofspdiagm(d => x)andspdiagm(d[1] => x[1], d[2] => x[2], ...)respectively. The newspdiagmimplementation now always returns a square matrix (#23757). -
spones(A::AbstractSparseArray)has been deprecated in favor ofLinAlg.fillstored!(copy(A), 1)(#25037). -
Constructors for
LibGit2.UserPasswordCredentialsandLibGit2.SSHCredentialswhich take aprompt_if_incorrectargument are deprecated. Instead, prompting behavior is controlled using theallow_promptkeyword in theLibGit2.CredentialPayloadconstructor (#23690). -
gradientis deprecated and will be removed in the next release (#23816). -
The timing functions
tic,toc, andtoqare deprecated in favor of@timeand@elapsed(#17046). -
Methods of
findfirst,findnext,findlast, andfindprevthat accept a value to search for are deprecated in favor of passing a predicate (#19186, #10593). -
findfunctions now operate only on booleans by default. To look for non-zeros, usex->x!=0or!iszero(#23120). -
The ability of
reinterpretto yieldArrays of different type than the underlying storage has been removed. Thereinterpretfunction is still available, but now returns aReinterpretArray. The three argument form ofreinterpretthat implicitly reshapes has been deprecated (#23750). -
bitshas been deprecated in favor ofbitstring(#24281, #24263). -
num2hexandhex2numhave been deprecated in favor ofreinterpretcombined withparse/hex(#22088). -
copy!is deprecated forAbstractSetandAbstractDict, with the intention to re-enable it with a cleaner meaning in a future version (#24844). -
copy!(resp.unsafe_copy!) is deprecated forAbstractArrayand is renamedcopyto!(resp.unsafe_copyto!); it will be re-introduced with a different meaning in a future version (#24808). -
a:bis deprecated for constructing aStepRangewhenaandbhave physical units (Dates and Times). Usea:s:b, wheres = Dates.Day(1)ors = Dates.Second(1). -
trues(A::AbstractArray)andfalses(A::AbstractArray)are deprecated in favor oftrues(size(A))andfalses(size(A))respectively (#24595). -
workspaceis discontinued, check out Revise.jl for an alternative workflow (#25046). -
cumsum,cumprod,accumulate, their mutating versions, anddiffall now require adimargument instead of defaulting to using the first dimension unless there is only one dimension (#24684, #25457). -
The
sum_kbnandcumsum_kbnfunctions have been moved to the KahanSummation package (#24869). -
isnumberhas been renamed toisnumeric(#25021). -
isalphahas been renamed toisletter(#26932). -
is_assigned_charandnormalize_stringhave been renamed toisassignedandnormalize, and moved to the newUnicodestandard library module.graphemeshas also been moved to that module (#25021). -
Sparse array functionality has moved to the
SparseArraysstandard library module (#25249). -
Linear algebra functionality, and specifically the
LinAlgmodule has moved to theLinearAlgebrastandard library module (#25571). -
@printfand@sprintfhave been moved to thePrintfstandard library (#23929,#25056). -
The
Libdlmodule has moved to theLibdlstandard library module (#25459). -
The aliases
Complex32,Complex64andComplex128have been deprecated in favor ofComplexF16,ComplexF32andComplexF64respectively (#24647). -
Base.parentindexesandSharedArrays.localindexeshave been renamed toparentindicesandlocalindices, respectively. Similarly, theindexesfield in theSubArraytype has been renamed toindiceswithout deprecation (#25088). -
Associativehas been deprecated in favor ofAbstractDict(#25012). -
Voidhas been renamed back toNothingwith an aliasCvoidfor use when calling C with a return type ofCvoidor a return or argument type ofPtr{Cvoid}(#25162). -
Nullable{T}has been deprecated and moved to the Nullables package (#23642). UseUnion{T, Nothing}instead, orUnion{Some{T}, Nothing}ifnothingis a possible value (i.e.Nothing <: T).isnull(x)can be replaced withx === nothingandunsafe_get/getcan be dropped or replaced withcoalesce.NullExceptionhas been removed. -
unshift!andshift!have been renamed topushfirst!andpopfirst!(#23902) -
ipermute!has been deprecated in favor ofinvpermute!(#25168). -
CartesianRangehas been renamedCartesianIndices(#24715). -
sub2indandind2subare deprecated in favor of usingCartesianIndicesandLinearIndices(#24715). -
getindex(F::Factorization, s::Symbol)(usually seen as e.g.F[:Q]) is deprecated in favor of dot overloading (getproperty) so factors should now be accessed as e.g.F.Qinstead ofF[:Q](#25184). -
searchandrsearchhave been deprecated in favor offindfirst/findnextandfindlast/findprevrespectively, in combination with curriedisequalandinpredicates for some methods (#24673). -
search(buf::IOBuffer, delim::UInt8)has been deprecated in favor of eitheroccursin(delim, buf)(to test containment) orreaduntil(buf, delim)(to read data up todelim) (#26600). -
ismatch(regex, str)has been deprecated in favor ofoccursin(regex, str)(#26283). -
matchallhas been deprecated in favor ofcollect(m.match for m in eachmatch(r, s))(#26071). -
similar(::Associative)has been deprecated in favor ofempty(::Associative), andsimilar(::Associative, ::Pair{K, V})has been deprecated in favour ofempty(::Associative, K, V)(#24390). -
findin(a, b)has been deprecated in favor offindall(in(b), a)(#24673). -
module_namehas been deprecated in favor of a new, generalnameoffunction. Similarly, the unexportedBase.function_nameandBase.datatype_namehave been deprecated in favor ofnameofmethods (#25622). -
The module
Random.dSFMTis renamedRandom.DSFMT(#25567). -
Random.RandomDevice(unlimited::Bool)(on non-Windows systems) is deprecated in favor ofRandom.RandomDevice(; unlimited=unlimited)(#25668). -
The generic implementations of
strides(::AbstractArray)andstride(::AbstractArray, ::Int)have been deprecated. Subtypes ofAbstractArraythat implement the newly introduced strided array interface should define their ownstridesmethod (#25321). -
module_parent,Base.datatype_module, andBase.function_modulehave been deprecated in favor ofparentmodule(#25629). -
rand(t::Tuple{Vararg{Int}})is deprecated in favor ofrand(Float64, t)orrand(t...);rand(::Tuple)will have another meaning in the future (#25429, #25278). -
randjump, which produced an array, is deprecated in favor of the scalar versionFuture.randjumpused withaccumulate(#27746). -
The
assertfunction (and@assertmacro) have been documented that they are not guaranteed to run under various optimization levels and should therefore not be used to e.g. verify passwords. -
ObjectIdDicthas been deprecated in favor ofIdDict{Any,Any}(#25210). -
gcandgc_enablehave been deprecated in favor ofGC.gcandGC.enable(#25616). -
Base.@gc_preservehas been deprecated in favor ofGC.@preserve(#25616). -
print_shortesthas been discontinued, but is still available in theBase.Grisusubmodule (#25745). -
scale!has been deprecated in favor ofmul!,lmul!, andrmul!(#25701, #25812). -
The
remove_destinationkeyword argument tocp,mv, and the unexportedcptreehas been renamed toforce(#25979). -
containshas been deprecated in favor of a more generaloccursinfunction, which takes its arguments in reverse order fromcontains(#26283). -
Regexobjects are no longer callable. Useoccursininstead (#26283). -
The methods of
rangebased on positional arguments have been deprecated in favor of keyword arguments (#25896). -
linspacehas been deprecated in favor ofrangewithstopandlengthkeyword arguments (#25896). -
LinSpacehas been renamed toLinRange(#25896). -
logspacehas been deprecated to its definition (#25896). -
endof(a)has been renamed tolastindex(a), and theendkeyword in indexing expressions now lowers to eitherlastindex(a)(in the case with only one index) orlastindex(a, d)(in cases where there is more than one index andendappears at dimensiond) (#23554, #25763). -
DateTime(),Date(), andTime()have been deprecated, instead useDateTime(1),Date(1)andTime(0)respectively (#23724). -
The fallback method
^(x, p::Integer)is deprecated. If your type relied on this definition, add a method such as^(x::MyType, p::Integer) = Base.power_by_squaring(x, p)(#23332). -
DevNull,STDIN,STDOUT, andSTDERRhave been renamed todevnull,stdin,stdout, andstderr, respectively (#25786). -
waitandfetchonTasknow resemble the interface ofFuture. -
showcompact(io, x...)has been deprecated in favor ofshow(IOContext(io, :compact => true), x...)(#26080). Usesprint(show, x..., context=:compact => true)instead ofsprint(showcompact, x...). -
isupper,islower,ucfirstandlcfirsthave been deprecated in favor ofisuppercase,islowercase,uppercasefirstandlowercasefirst, respectively (#26442). -
signifhas been deprecated in favor of thesigdigitskeyword argument toround. -
Base.IntSethas been deprecated in favor ofBase.BitSet(#24282). -
setroundinghas been deprecated forFloat32andFloat64, as the behaviour was too unreliable (#26935). -
gamma,lgamma,beta,lbetaandlfacthave been moved to SpecialFunctions.jl (#27459, #27473). -
atan2is now a 2-argument method ofatan(#27248). -
The functions
eigsandsvdshave been moved to theArpack.jlpackage (#27616). -
vecdotandvecnormare deprecated in favor ofdotandnorm, respectively (#27401). -
clipboardhas been moved to theInteractiveUtilsstandard library package (along with other utilities mostly used at the interactive prompt, such aseditandless) (#27635). -
ndigits(n, b, [pad])is deprecated in favor ofndigits(n, base=b, pad=pad)(#27908). -
squeezeis deprecated in favor ofdropdims. -
srandis deprecated in favor of the unexportedRandom.seed!(#27726). -
realmin/realmaxare deprecated in favor offloatmin/floatmax(#28302). -
sortrows/sortcolshave been deprecated in favor of the more generalsortslices. -
nextpow2/prevpow2have been deprecated in favor of the more generalnextpow/prevpowfunctions.
Command-line option changes
-
New option
--warn-overwrite={yes|no}to control the warning for overwriting method definitions. The default isno(#23002). -
New option
--banner={yes,no}allows suppressing or forcing the printing of the startup banner, overriding the default behavior (banner in REPL, no banner otherwise). The--quietoption implies--banner=noeven in REPL mode but can be overridden by passing--quiettogether with--banner=yes(#23342). -
The option
--precompiledhas been renamed to--sysimage-native-code(#23054). -
The option
--compilecachehas been renamed to--compiled-modules(#23054).
Julia v0.6.0 Release Notes
New language features
-
New type system capabilities (#8974, #18457)
-
Type parameter constraints can refer to previous parameters, e.g.
type Foo{R<:Real, A<:AbstractArray{R}}. Can also be used in method definitions. -
New syntax
Array{T} where T<:Integer, indicating a union of types over all specified values ofT(represented by aUnionAlltype). This provides behavior similar to parametric methods ortypealias, but can be used anywhere a type is accepted. This syntax can also be used in method definitions, e.g.function inv(M::Matrix{T}) where T<:AbstractFloat. Anonymous functions can have type parameters via the syntax((x::Array{T}) where T<:Real) -> 2x. -
Implicit type parameters, e.g.
Vector{<:Real}is equivalent toVector{T} where T<:Real, and similarly forVector{>:Int}(#20414). -
Much more accurate subtype and type intersection algorithms. Method sorting and identification of equivalent and ambiguous methods are improved as a result.
-
Language changes
-
"Inner constructor" syntax for parametric types is deprecated. For example, in this definition:
type Foo{T,S<:Real} x Foo(x) = new(x) endthe syntax
Foo(x) = new(x)actually defined a constructor forFoo{T,S}, i.e. the case where the type parameters are specified. For clarity, this definition now must be written asFoo{T,S}(x) where {T,S<:Real} = new(x)(#11310, #20308). -
The keywords used to define types have changed (#19157, #20418).
-
immutablechanges tostruct -
typechanges tomutable struct -
abstractchanges toabstract type ... end -
bitstype 32 Charchanges toprimitive type Char 32 end
In 0.6,
immutableandtypeare still allowed as synonyms without a deprecation warning. -
-
Multi-line and single-line nonstandard command literals have been added. A nonstandard command literal is like a nonstandard string literal, but the syntax uses backquotes (
`) instead of double quotes, and the resulting macro called is suffixed with_cmd. For instance, the syntaxq`xyz`is equivalent to@q_cmd "xyz"(#18644). -
Nonstandard string and command literals can now be qualified with their module. For instance,
Base.r"x"is now parsed asBase.@r_str "x". Previously, this syntax parsed as an implicit multiplication (#18690). -
For every binary operator
⨳,a .⨳ bis now automatically equivalent to thebroadcastcall(⨳).(a, b). Hence, one no longer defines methods for.*etcetera. This also means that "dot operations" automatically fuse into a single loop, along with other dot callsf.(x)(#17623). Similarly for unary operators (#20249). -
Newly defined methods are no longer callable from the same dynamic runtime scope they were defined in (#17057).
-
isais now parsed as an infix operator with the same precedence asin(#19677). -
@.is now parsed as@__dot__, and can be used to add dots to every function call, operator, and assignment in an expression (#20321). -
The identifier
_can be assigned, but accessing its value is deprecated, allowing this syntax to be used in the future for discarding values (#9343, #18251, #20328). -
The
typealiaskeyword is deprecated, and should be replaced withVector{T} = Array{T,1}or aconstassignment (#20500). -
Experimental feature:
x^nfor integer literalsn(e.g.x^3orx^-3) is now lowered toBase.literal_pow(^, x, Val{n}), to enable compile-time specialization for literal integer exponents (#20530, #20889).
Breaking changes
This section lists changes that do not have deprecation warnings.
-
readline,readlinesandeachlinereturn lines without line endings by default. You must usereadline(s, chomp=false), etc. to get the old behavior where returned lines include trailing end-of-line character(s) (#19944). -
Strings no longer have a.datafield (as part of a significant performance improvement). UseVector{UInt8}(str)to access a string as a byte array. However, allocating theVectorobject has overhead. You can also usecodeunit(str, i)to access theith byte of aString. Usesizeof(str)instead oflength(str.data), andpointer(str)instead ofpointer(str.data)(#19449). -
Operations between
Float16andIntegersnow returnFloat16instead ofFloat32(#17261). -
Keyword arguments are processed left-to-right: if the same keyword is specified more than once, the rightmost occurrence takes precedence (#17785).
-
The
lgamma(z)function now uses a different (more standard) branch cut forreal(z) < 0, which differs fromlog(gamma(z))by multiples of 2π in the imaginary part (#18330). -
broadcastnow handles tuples, and treats any argument that is not a tuple or an array as a "scalar" (#16986). -
broadcastnow produces aBitArrayinstead ofArray{Bool}for functions yielding a boolean result. If you wantArray{Bool}, usebroadcast!or.=(#17623). -
Broadcast
A[I...] .= Xwith entirely scalar indicesIis deprecated as its behavior will change in the future. UseA[I...] = Xinstead. -
Operations like
.+and.*onRangeobjects are now genericbroadcastcalls (see above) and produce anArray. If you want aRangeresult, use+and*, etcetera (#17623). -
broadcastnow treatsRef(except forPtr) arguments as 0-dimensional arrays (#18965). -
broadcastnow handles missing data (Nullables) allowing operations to be lifted over mixtures ofNullables and scalars, as if theNullablewere like an array with zero or one element (#16961, #19787). -
The runtime now enforces when new method definitions can take effect (#17057). The flip-side of this is that new method definitions should now reliably actually take effect, and be called when evaluating new code (#265).
-
The array-scalar methods of
/,\,*,+, and-now follow broadcast promotion rules. (Likewise for the now-deprecated array-scalar methods ofdiv,mod,rem,&,|, andxor; see "Deprecated or removed" below.) (#19692). -
broadcast!(f, A)now callsf()for each element ofA, rather than doingfill!(A, f())(#19722). -
rmprocsnow throws an exception if requested workers have not been completely removed beforewaitforseconds. With awaitfor=0,rmprocsreturns immediately without waiting for worker exits. -
quadgkhas been moved from Base into a separate package (#19741). -
The
Collectionsmodule has been removed, and all functions defined therein have been moved to theDataStructurespackage (#19800). -
The
RepStringtype has been moved to the LegacyStrings.jl package. -
In macro calls with parentheses, e.g.
@m(a=1), assignments are now parsed as=expressions, instead of askwexpressions (#7669). -
When used as an infix operator,
~is now parsed as a call to an ordinary operator with assignment precedence, instead of as a macro call (#20406). -
(µ "micro" and ɛ "latin epsilon") are considered equivalent to the corresponding Greek characters in identifiers.
\varepsilonnow tab-completes to U+03B5 (greek small letter epsilon) (#19464). -
retrynow inputs the keyword argumentsdelaysandcheckinstead ofnandmax_delay. The previous functionality can be achieved settingdelaystoExponentialBackOff(#19331). -
transpose(::AbstractVector)now always returns aRowVectorview of the input (which is a special 1×n-sizedAbstractMatrix), not aMatrix, etc. In particular, forv::AbstractVectorwe now have(v.').' === vandv.' * vis a scalar (#19670). -
Parametric types with "unspecified" parameters, such as
Array, are now represented asUnionAlltypes instead ofDataTypes (#18457). -
Uniontypes have two fields,aandb, instead of a singletypesfield. The empty typeUnion{}is represented by a singleton of typeTypeofBottom(#18457). -
The type
NTuple{N}now refers to tuples where every element has the same type (since it is shorthand forNTuple{N,T} where T). To get the old behavior of matching any tuple, useNTuple{N,Any}(#18457). -
FloatRangehas been replaced byStepRangeLen, and the internal representation ofLinSpacehas changed. Aside from changes in the internal field names, this leads to several differences in behavior (#18777):-
Both
StepRangeLenandLinSpacecan represent ranges of arbitrary object types---they are no longer limited to floating-point numbers. -
For ranges that produce
Float64,Float32, orFloat16numbers,StepRangeLencan be used to produce values with little or no roundoff error due to internal arithmetic that is typically twice the precision of the output result. -
To take advantage of this precision,
linspace(start, stop, len)now returns a range of typeStepRangeLenrather thanLinSpacewhenstartandstopareFloatNN.LinSpace(start, stop, len)always returns aLinSpace. -
StepRangeLen(a, step, len)constructs an ordinary-precision range using the values and types ofaandstepas given, whereasrange(a, step, len)will attempt to match inputsa::FloatNNandstep::FloatNNto rationals and construct aStepRangeLenthat internally uses twice-precision arithmetic. These two outcomes exhibit differences in both precision and speed.
-
-
A=>Bexpressions are now parsed as calls instead of using=>as the expression head (#20327). -
The
countfunction no longer sums non-boolean values (#20404) -
The generic
getindex(::AbstractString, ::AbstractVector)method's signature has been tightened togetindex(::AbstractString, ::AbstractVector{<:Integer}). Consequently, indexing intoAbstractStrings with non-AbstractVector{<:Integer}AbstractVectors now throws aMethodErrorin the absence of an appropriate specialization. (Previously such cases failed less explicitly with the exception ofAbstractVector{Bool}, which now throws anArgumentErrornoting that logical indexing into strings is not supported.) (#20248) -
Bessel, Hankel, Airy, error, Dawson, eta, zeta, digamma, inverse digamma, trigamma, and polygamma special functions have been moved from Base to the SpecialFunctions.jl package (#20427). Note that
airy,airyxandairyprimehave been deprecated in favor of more specific functions (airyai,airybi,airyaiprime,airybiprimex,airyaix,airybix,airyaiprimex,airybiprimex) (#18050). -
When a macro is called in the module in which that macro is defined, global variables in the macro are now correctly resolved in the macro definition environment. Breakage from this change commonly manifests as undefined variable errors that do not occur under 0.5. Fixing such breakage typically requires sprinkling additional
escs in the offending macro (#15850). -
writeon anIOBuffernow returns a signed integer in order to be consistent with other buffers (#20609). -
The
<:Integerdivision fallback/(::Integer, ::Integer), which formerly inappropriately took precedence over other division methods for some mixed-integer-type division calls, has been removed (#19779). -
@async,@spawn,@spawnat,@fetchand@fetchfromno longer implicitly localize variables. Previously, the expression would be wrapped in an implicitletblock (#19594). -
parseno longer accepts IPv4 addresses including leading zeros, octal, or hexadecimal. Convert IPv4 addresses including octal or hexadecimal to decimal, and remove leading zeros in decimal addresses (#19811). -
Closures shipped for remote execution via
@spawnorremotecallnow automatically serialize globals defined under Main. For details, please refer to the paragraph on "Global variables" under the "Parallel computing" chapter in the manual (#19594). -
homedirnow determines the user's home directory vialibuv'suv_os_homedir, rather than from environment variables (#19636). -
Workers now listen on an ephemeral port assigned by the OS. Previously workers would listen on the first free port available from 9009 (#21818).
Library improvements
-
A new
@viewsmacro was added to convert a whole expression or block of code to use views for all slices (#20164). -
max,min, and related functions (minmax,maximum,minimum,extrema) now returnNaNforNaNarguments (#12563). -
oneunit(x)function to return a dimensionful version ofone(x)(which is clarified to mean a dimensionless quantity ifxis dimensionful) (#20268). -
The
chopandchompfunctions now return aSubString(#18339). -
Numbered stackframes printed in stacktraces can now be opened in an editor by entering the corresponding number in the REPL and pressing
^Q(#19680). -
The REPL now supports something called prompt pasting (#17599). This activates when pasting text that starts with
julia>into the REPL. In that case, only expressions starting withjulia>are parsed, the rest are removed. This makes it possible to paste a chunk of code that has been copied from a REPL session without having to scrub away prompts and outputs. This can be disabled or enabled at will withBase.REPL.enable_promptpaste(::Bool). -
The function
print_with_colorcan now take a color represented by an integer between 0 and 255 inclusive as its first argument (#18473). For a number-to-color mapping, please refer to this chart. It is also possible to use numbers as colors in environment variables that customizes colors in the REPL. For example, to get orange warning messages, simply setENV["JULIA_WARN_COLOR"] = 208. Please note that not all terminals support 256 colors. -
The function
print_with_colorno longer prints text in bold by default (#18628). Instead, the function now take a keyword argumentbold::Boolwhich determines whether to print in bold or not. On some terminals, printing a color in non bold results in slightly darker colors being printed than when printing in bold. Therefore, light versions of the colors are now supported. For the available colors see the help entry onprint_with_color. -
The default text style for REPL input and answers has been changed from bold to normal (#11250). They can be changed back to bold by setting the environment variables
JULIA_INPUT_COLORandJULIA_ANSWER_COLORto"bold". For example, one way of doing this is addingENV["JULIA_INPUT_COLOR"] = :boldandENV["JULIA_ANSWER_COLOR"] = :boldto the.juliarc.jlfile. See the manual section on customizing colors for more information. -
The default color for info messages has been changed from blue to cyan (#18442), and for warning messages from red to yellow (#18453). This can be changed back to the original colors by setting the environment variables
JULIA_INFO_COLORto"blue"andJULIA_WARN_COLORto"red". -
Iteration utilities that wrap iterators and return other iterators (
enumerate,zip,rest,countfrom,take,drop,cycle,repeated,product,flatten,partition) have been moved to the moduleBase.Iterators(#18839). -
BitArrays can now be constructed from arbitrary iterables, in particular from generator expressions, e.g.
BitArray(isodd(x) for x = 1:100)(#19018). -
hcat,vcat, andhvcatnow work withUniformScalingobjects, so you can now do e.g.[A I]and it will concatenate an appropriately sized identity matrix (#19305). -
New
accumulateandaccumulate!functions were added, which generalizecumsumandcumprod. Also known as a scan operation (#18931). -
reshapenow allows specifying one dimension with aColon()(:) for the new shape, in which case that dimension's length will be computed such that its product with all the other dimensions is equal to the length of the original array (#19919). -
The new
to_indicesfunction provides a uniform interface for index conversions, taking an array and a tuple of indices as arguments and returning a tuple of integers and/or arrays of supported scalar indices. It will throw anArgumentErrorfor any unsupported indices, and the returned arrays should be iterated over (and not indexed into) to support more efficient logical indexing (#19730).-
Using colons (
:) to represent a collection of indices is deprecated. They now must be explicitly converted to a specialized array of integers with theto_indicesfunction. As a result, the type ofSubArrays that represent views over colon indices has changed. -
Logical indexing is now more efficient. Logical arrays are converted by
to_indicesto a lazy, iterable collection of indices that doesn't support indexing. A deprecation provides indexing support with O(n) lookup. -
The performance of indexing with
CartesianIndexes is also improved in many situations.
-
-
A new
titlecasefunction was added, to capitalize the first character of each word within a string (#19469). -
anyandallnow always short-circuit, andmapreducenever short-circuits (#19543). That is, not every member of the input iterable will be visited if atrue(in the case ofany) orfalse(in the case ofall) value is found, andmapreducewill visit all members of the iterable. -
Additional methods for
onesandzerosfunctions were added to support the same signature as thesimilarfunction (#19635). -
countnow has acount(itr)method equivalent tocount(identity, itr)(#20403). -
Methods for
mapandfilterwithNullablearguments have been implemented; the semantics are as if theNullablewere a container with zero or one elements (#16961). -
New
@test_warnand@test_nowarnmacros were added in theBase.Testmodule to test for the presence or absence of warning messages (#19903). -
loggingcan now be used to redirectinfo,warn, anderrormessages either universally or on a per-module/function basis (#16213). -
New function
Base.invokelatest(f, args...)to call the latest version of a function in circumstances where an older version may be called instead (e.g. in a function callingeval) (#19784). -
A new
iszero(x)function was added, to quickly check whetherxis zero (or is all zeros, for an array) (#19950). -
notifynow returns a count of tasks woken up (#19841). -
A new nonstandard string literal
raw"..."was added, for creating strings with no interpolation or unescaping (#19900). -
A new
Dates.Timetype was added that supports representing the time of day with up to nanosecond resolution (#12274). -
Raising one or negative one to a negative integer power formerly threw a
DomainError. One raised to any negative integer power now yields one, negative one raised to any negative even integer power now yields one, and negative one raised to any negative odd integer power now yields negative one. Similarly, raisingtrueto any negative integer power now yieldstruerather than throwing aDomainError(#18342). -
A new
@macroexpandmacro was added as a convenient alternative to themacroexpandfunction (#18660). -
invokenow supports keyword arguments (#20345). -
A new
ConjArraytype was added, as a wrapper type for lazy complex conjugation of arrays. Currently, it is used by default for the newRowVectortype only, and enforces that bothtranspose(vec)andctranspose(vec)are views not copies (#20047). -
remnow accepts aRoundingModeargument viarem(x, y, r::RoundingMode), yieldingx - y*round(x/y, r)without intermediate rounding. In particular,rem(x, y, RoundNearest)yields a value in the interval[-abs(y)/2, abs(y)/2]), which corresponds to the IEE754remainderfunction. Similarly,rem2pi(x, r::RoundingMode)now exists as well, yieldingrem(x, 2pi, r::RoundingMode)but with greater accuracy (#10946). -
map[!]andbroadcast[!]now have dedicated methods for sparse/structured vectors/matrices. Specifically,map[!]andbroadcast[!]over combinations including one or moreSparseVector,SparseMatrixCSC,Diagonal,Bidiagonal,Tridiagonal, orSymTridiagonal, and any number ofbroadcastscalars,Vectors, orMatrixs, now efficiently yieldSparseVectors orSparseMatrixs as appropriate (#19239, #19371, #19518, #19438, #19690, #19724, #19926, #19934, #20009). -
The operators
!and∘(\circ<tab>at the REPL and in most code editors) now respectively perform predicate function negation and function composition. For example,map(!iszero, (0, 1))is now equivalent tomap(x -> !iszero(x), (0, 1))andmap(uppercase ∘ hex, 250:255)is now equivalent tomap(x -> uppercase(hex(x)), 250:255)(#17155). -
enumeratenow supports the two-argument formenumerate(::IndexStyle, iterable). This form allows specification of the returned indices' style. For example,enumerate(IndexLinear, iterable)yields linear indices andenumerate(IndexCartesian, iterable)yields cartesian indices (#16378).
Compiler/Runtime improvements
-
ccallis now implemented as a macro, removing the need for special code-generator support forIntrinsics(#18754). -
ccallgained limited support for allvmcallcalling-convention. This can replace many uses ofllvmcallwith a simpler, shorter declaration (#18754). -
All
Intrinsicsare nowBuiltinfunctions instead and have proper error checking and fall-back static compilation support (#18754).
Deprecated or removed
-
ipermutedims(A::AbstractArray, p)has been deprecated in favor ofpermutedims(A, invperm(p))(#18891). -
Linear indexing is now only supported when there is exactly one non-cartesian index provided. Allowing a trailing index at dimension
dto linearly access the higher dimensions from arrayA(beyondsize(A, d)) has been deprecated as a stricter constraint during bounds checking. Instead,reshapethe array such that its dimensionality matches the number of indices (#20079). -
Multimedia.@textmime "mime"has been deprecated. Instead defineMultimedia.istextmime(::MIME"mime") = true(#18441). -
isdefined(a::Array, i::Int)has been deprecated in favor ofisassigned(#18346). -
The three-argument
SubArrayconstructor (which acceptsdims::Tupleas its third argument) has been deprecated in favor of the two-argument equivalent (thedims::Tupleargument being superfluous) (#19259). -
ishas been deprecated in favor of===(which used to be an alias foris) (#17758). -
Ambiguous methods for addition and subtraction between
UniformScalings andNumbers, for example(+)(J::UniformScaling, x::Number), have been deprecated in favor of unambiguous, explicit equivalents, for exampleJ.λ + x(#17607). -
numanddenhave been deprecated in favor ofnumeratoranddenominatorrespectively (#19233,#19246). -
delete!(ENV::EnvDict, k::AbstractString, def)has been deprecated in favor ofpop!(ENV, k, def). Be aware thatpop!returnskordef, whereasdelete!returnsENVordef(#18012). -
infix operator
$has been deprecated in favor of infix⊻or functionxor(#18977). -
The single-argument form of
write(write(x), with implicitSTDOUToutput stream), has been deprecated in favor of the explicit equivalentwrite(STDOUT, x)(#17654). -
Dates.recurhas been deprecated in favor offilter(#19288) -
A number of ambiguous
convertoperations betweenNumbers (especiallyReals) andDate,DateTime, andPeriodtypes have been deprecated in favor of unambiguousconvertand explicit constructor calls. Additionally, ambiguous colon construction of<:Periodranges without step specification, for exampleDates.Hour(1):Dates.Hour(2), has been deprecated in favor of such construction including step specification, for exampleDates.Hour(1):Dates.Hour(1):Dates.Hour(2)(#19920). -
cumminandcummaxhave been deprecated in favor ofaccumulate(#18931). -
The
Arrayconstructor syntaxArray(T, dims...)has been deprecated in favor of the formsArray{T,N}(dims...)(whereNis known, or particularlyVector{T}(dims...)forN = 1andMatrix{T}(dims...)forN = 2), andArray{T}(dims...)(whereNis not known). Likewise forSharedArrays (#19989). -
sumabsandsumabs2have been deprecated in favor ofsum(abs, x)andsum(abs2, x), respectively.maxabsandminabshave similarly been deprecated in favor ofmaximum(abs, x)andminimum(abs, x). Likewise for the in-place counterparts of these functions (#19598). -
The array-reducing form of
isinteger(isinteger(x::AbstractArray)) has been deprecated in favor ofall(isinteger, x)(#19925). -
produce,consumeand iteration over a Task object have been deprecated in favor of using Channels for inter-task communication (#19841). -
The
negatekeyword has been deprecated from all functions in theDatesadjuster API (adjust,tonext,toprev,Date,Time, andDateTime). Instead use predicate function negation via the!operator (see Library Improvements) (#20213). -
@test_approx_eq x yhas been deprecated in favor of@test isapprox(x,y)or@test x ≈ y(#4615). -
Matrix()andMatrix{T}()have been deprecated in favor of the explicit formsMatrix(0, 0)andMatrix{T}(0, 0)(#20330). -
Vectorized functions have been deprecated in favor of dot syntax (#17302, #17265, #18558, #19711, #19712, #19791, #19802, #19931, #20543, #20228).
-
All methods of character predicates (
isalnum,isalpha,iscntrl,isdigit,isnumber,isgraph,islower,isprint,ispunct,isspace,isupper,isxdigit) that acceptAbstractStringshave been deprecated in favor ofall. For example,isnumber("123")should now be expressedall(isnumber, "123")(#20342). -
A few names related to indexing traits have been changed:
LinearIndexingandlinearindexinghave been deprecated in favor ofIndexStyle.LinearFasthas been deprecated in favor ofIndexLinear, andLinearSlowhas been deprecated in favor ofIndexCartesian(#16378). -
The two-argument forms of
map(map!(f, A)) andasyncmap!(asyncmap!(f, A)) have been deprecated in anticipation of future semantic changes (#19721). -
unsafe_wrap(String, ...)has been deprecated in favor ofunsafe_string(#19449). -
zerosandonesmethods accepting an element type as the first argument and an array as the second argument, for examplezeros(Float64, [1, 2, 3]), have been deprecated in favor of equivalent methods with the second argument instead the size of the array, for examplezeros(Float64, size([1, 2, 3]))(#21183). -
Base.promote_eltype_ophas been deprecated (#19669, #19814, #19937). -
isimaghas been deprecated (#19949). -
The tuple-of-types form of
invoke,invoke(f, (types...), ...), has been deprecated in favor of the tuple-type forminvoke(f, Tuple{types...}, ...)(#18444). -
Base._promote_array_typehas been deprecated (#19766). -
Methods allowing indexing of tuples by
AbstractArrays with more than one dimension have been deprecated. (Indexing a tuple by such a higher-dimensionalAbstractArrayshould yield a tuple with more than one dimension, but tuples are one-dimensional.) (#19737). -
@test_approx_eq a bhas been deprecated in favor of@test a ≈ b(or, equivalently,@test ≈(a, b)or@test isapprox(a, b)).@test_approx_eq_epshas been deprecated in favor of new@testsyntax:@testnow supports the syntax@test f(args...) key=val ...for@test f(args..., key=val...). This syntax allows, for example, writing@test a ≈ b atol=cin place of@test ≈(a, b, atol=c)(and hence@test_approx_eq_eps a b c) (#19901). -
takebuf_arrayhas been deprecated in favor oftake!, andtakebuf_string(x)has been deprecated in favor ofString(take!(x))(#19088). -
convertmethods fromDiagonalandBidiagonalto subtypes ofAbstractTriangularhave been deprecated (#17723). -
Base.LinAlg.arithtypehas been deprecated. If you were usingarithtypewithin apromote_opcall, instead usepromote_op(Base.LinAlg.matprod, Ts...). Otherwise, consider defining equivalent functionality locally (#18218). -
Special characters (
#{}()[]<>|&*?~;) should now be quoted in commands. For example,`export FOO=1\;`should replace`export FOO=1;`and`cd $dir '&&' $thingie`should replace`cd $dir && $thingie`(#19786). -
Zero-argument
Channelconstructors (Channel(),Channel{T}()) have been deprecated in favor of equivalents accepting an explicitChannelsize (Channel(2),Channel{T}(2)) (#18832). -
The zero-argument constructor
MersenneTwister()has been deprecated in favor of the explicitMersenneTwister(0)(#16984). -
Base.promote_type(op::Type, Ts::Type...)has been removed as part of an overhaul ofbroadcast's promotion mechanism. If you need the functionality of thatBase.promote_typemethod, consider defining it locally viaCore.Compiler.return_type(op, Tuple{Ts...})(#18642). -
bitbroadcasthas been deprecated in favor ofbroadcast, which now produces aBitArrayinstead ofArray{Bool}for functions yielding a boolean result (#19771). -
To complete the deprecation of histogram-related functions,
midpointshas been deprecated. Instead use the StatsBase.jl package'smidpointsfunction (#20058). -
Passing a type argument to
LibGit2.cathas been deprecated in favor of a simpler, two-argument method forLibGit2.cat(#20435). -
The
LibGit2.ownerfunction for finding the repository which owns a given Git object has been deprecated in favor ofLibGit2.repository(#20135). -
The
LibGit2.GitAnyObjecttype has been renamed toLibGit2.GitUnknownObjectto clarify its intent (#19935). -
The
LibGit2.GitOidtype has been renamed toLibGit2.GitHashfor clarity (#19878). -
Finalizing
LibGit2objects withfinalizehas been deprecated in favor of usingclose(#19660). -
Parsing string dates from a
Dates.DateFormatobject has been deprecated as part of a larger effort toward faster, more extensible date parsing (#20952).
Command-line option changes
- In
pollybuilds (USE_POLLY := 1), the new flag--polly={yes|no}controls whether@pollydeclarations are respected. (With--polly=no,@pollydeclarations are ignored.) This flag is also available in non-pollybuilds (USE_POLLY := 0), but has no effect (#18159).
Julia v0.5.0 Release Notes
New language features
-
Generator expressions:
f(i) for i in 1:n(#4470). This returns an iterator that computes the specified values on demand. This is useful for computing, e.g.sum(f(i) for i in 1:n)without creating an intermediate array of values. -
Generators and comprehensions support filtering using
if(#550) and nested iteration using multipleforkeywords (#4867). -
Fused broadcasting syntax:
f.(args...)is equivalent tobroadcast(f, args...)(#15032), and nestedf.(g.(args...))calls are fused into a singlebroadcastloop (#17300). Similarly, the syntaxx .= ...is equivalent to abroadcast!(identity, x, ...)call and fuses with nested "dot" calls; also,x .+= yand similar is now equivalent tox .= x .+ y, rather thanx = x .+ y(#17510). -
Macro expander functions are now generic, so macros can have multiple definitions (e.g. for different numbers of arguments, or optional arguments) (#8846, #9627). However note that the argument types refer to the syntax tree representation, and not to the types of run time values.
-
Varargs functions like
foo{T}(x::T...)may now restrict the number of such arguments usingfoo{T,N}(x::Vararg{T,N})(#11242). -
x ∈ Xis now a synonym forx in Xinforloops and comprehensions, as it already was in comparisons (#13824). -
The
PROGRAM_FILEglobal is now available for determining the name of the running script (#14114). -
The syntax
x.:sym(e.g.Base.:+) is now supported, while usingx.(:sym)orx.(i)for field access are deprecated in favor ofgetfield(#15032). -
Function return type syntax
function f()::Thas been added (#1090). Values returned from a function with such a declaration will be converted to the specified typeT. -
Many more operators now support
.prefixes (e.g..≤) (#17393). However, users are discouraged from overloading these, since they are mainly parsed in order to implement backwards compatibility with planned automatic broadcasting of dot operators in Julia 0.6 (#16285). Explicitly qualified operator names likeBase.≤should now useBase.:≤(prefixed by@compatif you need 0.4 compatibility via theCompatpackage). -
User-extensible bounds check elimination is now possible with the new
@boundscheckmacro (#14474). This macro marks bounds checking code blocks, which the compiler may remove when encountered inside an@inboundscall.
Experimental language features
-
Support for multi-threading. Loops with independent iterations can be easily parallelized with the
Threads.@threadsmacro. -
Support for arrays with indexing starting at values different from 1. The array types are expected to be defined in packages, but now Julia provides an API for writing generic algorithms for arbitrary indexing schemes (#16260).
Language changes
-
Each function and closure now has its own type. The captured variables of a closure are fields of its type.
Functionis now an abstract type, and is the default supertype of functions and closures. All functions, including anonymous functions, are generic and support all features (e.g. keyword arguments). Instead of adding methods tocall, methods are added by type using the syntax(::ftype)(...) = ....callis deprecated (#13412). A significant result of this language change is that higher order functions can be specialized on their function arguments, leading to much faster functional programming, typically as fast as if function arguments were manually inlined. See below for details. -
Square brackets and commas (e.g.
[x, y]) no longer concatenate arrays, and always simply construct a vector of the provided values. Ifxandyare arrays,[x, y]will be an array of arrays (#3737, #2488, #8599). -
usingandimportare now case-sensitive even on case-insensitive filesystems (common on Mac and Windows) (#13542). -
Relational algebra symbols are now allowed as infix operators (#8036):
⨝,⟕,⟖,⟗for joins and▷for anti-join. -
A warning is always given when a method is overwritten; previously, this was done only when the new and old definitions were in separate modules (#14759).
-
The
ifkeyword cannot be followed immediately by a line break (#15763). -
Juxtaposition of numeric literals ending in
.(e.g.1.x) is no longer allowed (#15731). -
The built-in
NTupletype has been removed;NTuple{N,T}is now implemented internally asTuple{Vararg{T,N}}(#11242). -
Use of the syntax
x::Tto declare the type of a local variable is deprecated. In the future this will always mean type assertion, and declarations should uselocal x::Tinstead (#16071). Whenxis global,x::T = ...andglobal x::Tused to mean type assertion, but this syntax is now reserved for type declaration (#964). -
Dictionary comprehension syntax
[ a=>b for x in y ]is deprecated. UseDict(a=>b for x in y)instead (#16510). -
Parentheses are no longer allowed around iteration specifications, e.g.
for (i = 1:n)(#17668).
Breaking changes
This section lists changes that do not have deprecation warnings.
-
All dimensions indexed by scalars are now dropped, whereas previously only trailing scalar dimensions would be omitted from the result (#13612). This is a very major behavioral change, but should cause obvious failures. To retain a dimension sliced with a scalar
islice withi:iinstead. -
The assignment operations
.+=,.*=and so on now generate calls tobroadcast!on the left-hand side (or call toview(a, ...)on the left-hand side if the latter is an indexing expression, e.g.a[...]). This means that they will fail if the left-hand side is immutable (or does not supportview), and will otherwise change the left-hand side in-place (#17510, #17546). -
Method ambiguities no longer generate warnings when files are loaded, nor do they dispatch to an arbitrarily-chosen method; instead, a call that cannot be resolved to a single method results in a
MethodErrorat run time, rather than the previous definition-time warning (#6190). -
Array comprehensions preserve the dimensions of the input ranges. For example,
[2x for x in A]will have the same dimensions asA(#16622). -
The result type of an array comprehension depends only on the types of elements computed, instead of using type inference (#7258). If the result is empty, then type inference is still used to determine the element type.
-
reshapeis now defined to always share data with the original array. If a reshaped copy is needed, usecopy(reshape(a))orcopy!to a new array of the desired shape (#4211). -
mapslicesnow re-uses temporary storage. Recipient functions that expect input slices to be persistent should copy data to other storage (#17266). All usages ofmapslicesshould be carefully audited since this change can cause silent, incorrect behavior, rather than failing noisily. -
Local variables and arguments are represented in lowered code as numbered
Slotobjects instead of as symbols (#15609). -
The information that used to be in the
astfield of theLambdaStaticDatatype is now divided among the fieldscode,slotnames,slottypes,slotflags,gensymtypes,rettype,nargs, andisvain theLambdaInfotype (#15609). -
A <: Bis parsed asExpr(:(<:), :A, :B)in all cases (#9503). This also applies to the>:operator. -
Simple 2-argument comparisons like
A < Bare parsed as calls instead of using the:comparisonexpression type (#15524). The:comparisonexpression type is still produced in ASTs when comparisons are chained (e.g.A < B ≤ C). -
mapon a dictionary now expects a function that expects and returns aPair. The result is now another dictionary instead of an array (#16622). -
Bit shift operations (i.e.
<<,>>, and>>>) now handle negative shift counts differently: Negative counts are interpreted as shifts in the opposite direction. For example,4 >> -1 == 4 << +1 == 8. Previously, negative counts would implicitly overflow to large positive counts, always yielding either0or-1.
Library improvements
-
Strings (#16107):
-
The
UTF8StringandASCIIStringtypes have been merged into a singleStringtype (#16058). Useisascii(s)to check whether a string contains only ASCII characters. Theascii(s)function now convertsstoString, raising anArgumentErrorexception ifsis not pure ASCII. -
The
UTF16StringandUTF32Stringtypes and correspondingutf16andutf32converter functions have been removed from the standard library. If you need these types, they have been moved to the LegacyStrings.jl package. In the future, more robust Unicode string support will be provided by the StringEncodings.jl package. If you only need these types to call wide string APIs (UTF-16 on Windows, UTF-32 on UNIX), consider using the newtranscodefunction (see below) or theCwstringtype as accallargument type, which also ensures correct NUL termination of string data. -
A
transcode(T, src)function is now exported for converting data between UTF-xx Unicode encodings (#17323). -
The basic string construction routines are now
string(args...),String(s),unsafe_string(ptr)(formerlybytestring(ptr)), andunsafe_wrap(String, ptr)(formerlypointer_to_string) (#16731). -
Comparisons between
Chars andIntegers are now deprecated (#16024):'x' == 120now produces a warning but still evaluates totrue. In the future it may evaluate tofalseor the comparison may be an error. To compare characters with integers you should either convert the integer to a character value or convert the character to the corresponding code point first: e.g.'x' == Char(120)orInt('x') == 120. The former is usually preferable. -
Support for Unicode 9 (#17402).
-
-
Arrays and linear algebra:
-
Dimensions indexed by multidimensional arrays add dimensions. More generally, the dimensionality of the result is the sum of the dimensionalities of the indices (#15431).
-
New
normalizeandnormalize!convenience functions for normalizing vectors (#13681). -
QR matrix factorization:
-
A new
SparseVectortype allows for one-dimensional sparse arrays. Slicing and reshaping sparse matrices now return vectors when appropriate. Thesparsevecfunction returns a one-dimensional sparse vector instead of a one-column sparse matrix. TheSparseMatrixmodule has been renamed toSparseArrays(#13440). -
Rank one update and downdate functions,
lowrankupdate,lowrankupdate!,lowrankdowndate, andlowrankdowndate!, have been introduced for dense Cholesky factorizations (#14243, #14424). -
All
sparsemethods now retain provided numerical zeros as structural nonzeros; to drop numerical zeros, usedropzeros!(#14798, #15242). -
setindex!methods for sparse matrices and vectors no longer purge allocated entries on zero assignment. To drop stored entries from sparse matrices and vectors, useBase.SparseArrays.dropstored!(#17404). -
Concatenating dense and sparse matrices now returns a sparse matrix (#15172).
-
-
Files and I/O:
-
The
openfunction now respectsumaskon UNIX when creating files (#16466, #16502). -
A new function
walkdir()returns an iterator that walks the tree of a directory (#8814, #13707).for (root, dirs, files) in walkdir(expanduser("~/.julia/v0.5/Plots/src")) println("$(length(files)) \t files in $root") end 19 files in /Users/me/.julia/v0.5/Plots/src 15 files in /Users/me/.julia/v0.5/Plots/src/backends 4 files in /Users/me/.julia/v0.5/Plots/src/deprecated -
A new function
chown()changes the ownership of files (#15007). -
Display properties can now be passed among output functions (e.g.
show) using anIOContextobject (#13825). -
Cmd(cmd; ...)now accepts new Windows-specific optionswindows_verbatim(to alter Windows command-line generation) andwindows_hide(to suppress creation of new console windows) (#13780). -
There is now a default no-op
flush(io)function for allIOtypes (#16403).
-
-
Parallel computing:
-
pmapkeyword argumentserr_retry=trueanderr_stop=falseare deprecated. Action to be taken on errors can be specified via theon_errorkeyword argument. Retry is specified viaretry_n,retry_onandretry_max_delay(#15409, #15975, #16663). -
The functions
remotecall,remotecall_fetch, andremotecall_waitnow have the function argument as the first argument to allow for do-block syntax (#13338).
-
-
Statistics:
-
Testing:
-
The
Base.Testmodule now has a@testsetfeature to bundle tests together and delay throwing an error until the end (#13062). -
The new features are mirrored in the BaseTestNext.jl package for users who would like to use the new functionality on Julia v0.4.
-
The BaseTestDeprecated.jl package provides the old-style
handlerfunctionality, for compatibility with code that needs to support both Julia v0.4 and v0.5.
-
-
Package management:
-
The package system (
Pkg) is now based on thelibgit2library, rather than running thegitprogram, increasing performance (especially on Windows) (#11196). -
Package-development functions like
Pkg.tagandPkg.publishhave been moved to an external PkgDev package (#13387). -
Updating only a subset of the packages is now supported, e.g.
Pkg.update("Example")(#17132).
-
-
Miscellaneous:
-
Prime number related functions have been moved from
Baseto the Primes.jl package (#16481). -
Most of the combinatorics functions have been moved from
Baseto the Combinatorics.jl package (#13897). -
New
foreachfunction for calling a function on every element of a collection when the results are not needed (#13774). Compared tomap(f, v), which allocates and returns a result array,foreach(f, v)callsfon each element ofv, returning nothing. -
The new
Base.StackTracesmodule makes stack traces easier to use programmatically (#14469). -
The
libjulialibrary is now properly versioned and installed to the public<prefix>/libdirectory, instead of the private<prefix>/lib/juliadirectory (#16362). -
System reflection is now more consistently exposed from
Sysand notBase(e.g. constants such asWORD_SIZEandCPU_CORES).OS_NAMEhas been replaced bySys.KERNELand always reports the name of the kernel (as reported byuname). The@windows_onlyand@osxfamily of macros have been replaced with functions such asis_windows()andis_apple(). There is now also a@staticmacro that will evaluate the condition of an if-statement at compile time, for when a static branch is required (#16219). -
DateandDateTimevalues can now be rounded to a specified resolution (e.g., 1 month or 15 minutes) withfloor,ceil, andround(#17037).
-
Compiler/Runtime improvements
-
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).
New architectures
This release greatly improves support for ARM, and introduces support for Power.
Deprecated or removed
-
The following function names have been simplified and unified (#13232):
-
get_bigfloat_precision->precision(BigFloat) -
set_bigfloat_precision->setprecision -
with_bigfloat_precision->setprecision -
get_rounding->rounding -
set_rounding->setrounding -
with_rounding->setrounding
-
-
The method
A_ldiv_B!(SparseMatrixCSC, StridedVecOrMat)has been deprecated in favor of versions that require the matrix to be in factored form (#13496). -
chol(A,Val{:U/:L})has been deprecated in favor ofchol(A)(#13680). -
rem1(x,y)is discontinued due to inconsistency forx==0. Usemod1instead (#14140). -
The
FSmodule has been renamed toFilesystem. Calling the functionsisreadable,iswritable, andisexecutableon filesystem paths has been deprecated (#12819). -
RemoteRefhas been deprecated in favor ofRemoteChannel(#14458). -
superhas been renamed tosupertype(#14335). -
parseip(str)has been deprecated in favor ofparse(IPAddr, str)(#14676). -
readallhas been renamed toreadstring, andreadbyteshas been renamed toread(#14608, #14660). -
fieldoffsets(x)has been deprecated in favor of callingfieldoffset(x, i)on each field (#14777). -
issymis deprecated in favor ofissymmetricto match similar functions (ishermitian, ...) (#15192). -
scaleis deprecated in favor of eitherα*A,Diagonal(x)*A, orA*Diagonal(x)(#15258). -
"Functor" types are no longer necessary and have been deprecated (#15804). To maintain performance on older versions of Julia the Compat.jl package provides a
@functorizemacro. -
bitunpack(B)andbitpack(A)have been deprecated in favor ofArray(B)andBitArray(A), respectively (#16010). -
xdumpis removed, anddumpnow simply shows the full representation of a value.dumpshould not be overloaded, since it is for examining concrete structure (#4163). -
sprandboolhas been deprecated in favor ofsprand(Bool, ...)orsprand(rng, Bool, ...)(#11688, #16098). -
The lowercase
symbolfunction has been deprecated in favor of theSymbolconstructor (#16154). -
writemimeis deprecated, and output methods specifying a MIME type are now methods ofshow(#14052). -
BLAS utility functions
blas_set_num_threads,blas_vendor, andcheck_blashave been moved to the BLAS module asBLAS.set_num_threads,BLAS.vendor, andBLAS.check(#10548, #16600). -
print_escapedhas been renamed toescape_string,print_unescapedhas been renamed tounescape_string, andprint_joinedhas been renamed tojoin(#16603). -
pointer_to_stringhas been renamed tounsafe_wrap(String, ...), andpointer_to_arrayhas been renamed tounsafe_wrap(Array, ...)(#16731). -
subandslicehave been deprecated in favor ofview(#16972). -
Sparse matrix functions
etree,ereach,csc_permute, andsympermhave been moved to the SuiteSparse.jl package (#12231, #17033). -
The no-op
transposefallback for non-numeric arrays has been deprecated. Consider introducing suitabletransposemethods or callingpermutedims(x, (2, 1))for matrices andreshape(x, 1, length(x))for vectors. (#13171, #17075, #17374). -
The following macros have been deprecated (#16219):
@windowsis deprecated in favor ofis_windows()@unixis deprecated in favor ofis_unix()@osxis deprecated in favor ofis_apple()@linuxis deprecated in favor ofis_linux()@windows_onlyis deprecated in favor ofif is_windows()@unix_onlyis deprecated in favor ofif is_unix()@osx_onlyis deprecated in favor ofif is_apple()@linux_onlyis deprecated in favor ofif is_linux()- NOTE: Using
@staticcould be useful/necessary when used in a function's local scope. See details at the section entitled Handling Operating System Variation in the manual.
Command-line option changes
-
The
-Fflag to load~/.juliarchas been deprecated in favor of--startup-file=yes(#9482). -
The
-fand--no-startupflags to disable loading of~/.juliarchave been deprecated in favor of--startup-file=no(#9482). -
The
-Pand--post-bootflags for evaluating an expression in "interactive mode" have been deprecated in favor of-i -e(#16854). -
The
--no-history-fileflag to disable loading of~/.julia_historyhas been deprecated in favor of--history-file=no(#9482).
Language tooling improvements
-
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.
Julia v0.4.0 Release Notes
New language features
-
Function call overloading: for arbitrary objects
x(not of typeFunction),x(...)is transformed intocall(x, ...), andcallcan be overloaded as desired. Constructors are now a special case of this mechanism, which allows e.g. constructors for abstract types.T(...)falls back toconvert(T, x), so allconvertmethods implicitly define a constructor (#8712, #2403). -
Unicode version 8 is now supported for identifiers etcetera (#7917, #12031).
-
Type parameters now permit any
isbitstype, not justIntandBool(#6081). -
Keyword argument names can be computed, using syntax such as
f(; symbol => val)(#7704). -
The syntax
@generated functionenables generation of specialized methods based on argument types. At compile time, the function is called with its arguments bound to their types instead of to their values. The function then returns an expression forming the body of the function to be called at run time (#7311). -
Documentation system for functions, methods, types and macros in packages and user code (#8791).
-
The syntax
function foo endcan be used to introduce a generic function without yet adding any methods (#8283). -
Incremental precompilation of modules: call
VERSION >= v"0.4.0-dev+6521" && __precompile__()at the top of a module file to automatically precompile it when it is imported (#12491), or manually runBase.compilecache(modulename). The resulting precompiled.jifile is saved in~/.julia/lib/v0.4(#8745).-
See manual section on
Module initialization and precompilation(underModules) for details and errata. In particular, to be safely precompilable a module may need an__init__function to separate code that must be executed at runtime rather than precompile time. Modules that are not precompilable should call__precompile__(false). -
The precompiled
.jifile includes a list of dependencies (modules and files that were imported/included at precompile-time), and the module is automatically recompiled uponimportwhen any of its dependencies have changed. Explicit dependencies on other files can be declared withinclude_dependency(path)(#12458). -
New option
--output-incremental={yes|no}added to invoke the equivalent ofBase.compilecachefrom the command line.
-
-
The syntax
new{parameters...}(...)can be used in constructors to specify parameters for the type to be constructed (#8135). -
++is now parsed as an infix operator, but does not yet have a default definition (#11030, #11686). -
Support for inter-task communication using
Channels(#12264). See https://docs.julialang.org/en/v1/manual/parallel-computing/#Channels-1 for details. -
RemoteRefs now point to remote channels. The remote channels can be of length greater than 1. Default continues to be of length 1 (#12385). See https://docs.julialang.org/en/v1/manual/parallel-computing/#Remote-References-and-AbstractChannels-1 for details. -
@__LINE__special macro now available to reflect invocation source line number (#12727).
Language changes
-
Tuple types are now written as
Tuple{A, B}instead of as(A, B). Tuples of bits types are inlined into structs and arrays, like other immutable types....now does splatting inside parentheses, instead of constructing a variadic tuple type (#10380). Variadic tuple types are written asTuple{Vararg{T}}. -
Using
[x,y]to concatenate arrays is deprecated, and in the future will construct a vector ofxandyinstead (#3737, #2488, #8599). -
Significant improvements to
ccallandcfunction-
As a safer alternative to creating pointers (
Ptr), the managed reference typeRefhas been added. ARefpoints to the data contained by a value in an abstract sense, and in a way that is GC-safe. For example,Ref(2)points to a storage location that contains the integer2, andRef(array,3)points to the third element of an array. ARefcan be automatically converted to a native pointer when passed to accall. -
When passing a by-reference argument to
ccall, you can declare the argument type to beRef{T}instead ofPtr{T}, and just passxinstead of&x. -
ccallis now lowered to callunsafe_convert(T, cconvert(T, x))on each argument.cconvertfalls back toconvert, but can be used to convert an argument to an arbitrarily-different representation more suitable for passing to C.unsafe_convertthen handles conversions toPtr. -
ccallandcfunctionnow support correctly passing and returning structs, following the platform ABI (assuming the C types are mirrored accurately in Julia). -
cfunctionarguments of struct-like Julia types are now passed by value. IfRef{T}is used as acfunctionargument type, it will look up the method applicable toT, but pass the argument by reference (as Julia functions usually do). However, this should only be used for objects allocated by Julia and forisbitstypes.
-
-
convert(Ptr,x)is deprecated for most types, replaced byunsafe_convert. You can stillconvertbetween pointer types, and between pointers andIntorUInt. -
Module
__init__methods no longer swallow thrown exceptions; they now throw anInitErrorwrapping the thrown exception (#12576). -
Unsigned
BigIntliteral syntax has been removed (#11105). Unsigned literals larger thanUInt128now throw a syntax error. -
error(::Exception)anderror(::Type{Exception})have been deprecated in favor of using an explicitthrow(#9690). -
Uintetcetera are renamed toUInt(#8905). -
Stringis renamed toAbstractString(#8872). -
FloatingPointis renamed toAbstractFloat(#12162). -
Noneis deprecated; useUnion{}instead (#8423). -
Nothing(the type ofnothing) is renamed toVoid(#8423). -
Arrays can be constructed with the syntax
Array{T}(m,n)(#3214, #10075). -
Dictliteral syntax[a=>b,c=>d]is replaced byDict(a=>b,c=>d),{a=>b}is replaced byDict{Any,Any}(a=>b), and(K=>V)[...]is replaced byDict{K,V}(...). The new syntax has many advantages: all of its components are first-class, it generalizes to other types of containers, it is easier to guess how to specify key and value types, and the syntaxes for empty and pre-populated dicts are synchronized. As part of this change,=>is parsed as a normal operator, andBasedefines it to constructPairobjects (#6739). -
Charis no longer a subtype ofInteger(#8816). Char now supports a more limited set of operations withIntegertypes:- comparison / equality
Char+Int=CharChar-Char=Int
-
roundrounds to the nearest integer using the default rounding mode, which is ties-to-even by default (#8750). -
A custom triple-quoted string like
x"""..."""no longer invokes anx_mstrmacro. Instead, the string is first unindented and thenx_stris invoked, as if the string had been single-quoted (#10228). -
Colons (
:) within indexing expressions are no longer lowered to the range1:end. Instead, the:identifier is passed directly. Custom array types that implementgetindexorsetindex!methods must also extend those methods to support arguments of typeColon(#10331). -
Unions of types should now be written with curly braces instead of parentheses, i.e.
Union{Type1, Type2}instead ofUnion(Type1, Type2)(#11432). -
The keyword
localis no longer allowed in global scope. Useletinstead ofbeginto create a new scope from the top level (#7234, #10472). -
Triple-quoted strings no longer treat tabs as 8 spaces. Instead, the longest common prefix of spaces and tabs is removed.
-
global xin a nested scope is now a syntax error ifxis local to the enclosing scope (#7264/#11985). -
The default
importall Base.Operatorsis deprecated, and relying on it will give a warning (#8113). -
remotecall_fetchandfetchnow rethrow any uncaught remote exception locally as aRemoteException. Previously they would return the remote exception object. The worker pid, remote exception and remote backtrace are available in the thrownRemoteException. -
If any of the enclosed async operations in a
@syncblock throw exceptions, they are now collected in aCompositeExceptionand theCompositeExceptionthrown.
Command line option changes
-
The
-ioption now forces the REPL to run after loading the specified script (if any) (#11347). -
New option
--handle-signals={yes|no}to disable Julia's signal handlers. -
The
--depwarn={yes|no|error}option enables/disables syntax and method deprecation warnings, or turns them into errors (#9294). -
Some command line options are slated for deprecation / removal
-f, --no-startupDon't load ~/.juliarc (deprecated, use --startup-file=no)-FLoad ~/.juliarc (deprecated, use --startup-file=yes)`-P, --post-boot <expr>Evaluate , but don't disable interactive mode (deprecated, use -i -e instead)--no-history-fileDon't load history file (deprecated, use --history-file=no)
Compiler/Runtime improvements
-
Functions may be annotated with metadata (
:metaexpressions) to be used by the compiler (#8297). -
@inlinebefore a function definition forces the compiler to inline the function (#8297). -
Loads from heap-allocated immutables are hoisted out of loops in more cases (#8867).
-
Accessing fields that are always initialized no longer produces undefined checks (#8827).
-
New generational garbage collector which greatly reduces GC overhead for many common workloads (#5227).
Library improvements
-
Build with USE_GPL_LIBS=0 to exclude all GPL libraries and code (#10870).
-
Linear algebra
-
The
LinAlgmodule is now exported. -
sparse(A)now takes anyAbstractMatrixA as an argument (#10031). -
Factorization API is now type-stable; functions dispatch on
Val{false}orVal{true}instead of a boolean value (#9575). -
Added generic Cholesky factorization, and the Cholesky factorization is now parametrized by the matrix type (#7236).
-
Sparse
cholfactandldltfactfunctions now accept apermkeyword for user-provided permutations and ashiftkeyword to factorize a shifted matrix (#10844). -
New
svdsfunction for the sparse truncated SVD (#9425). -
SymmetricandHermitianimmutables are now parametrized by the matrix type (#7992). -
New
ordschurandordschur!functions for sorting a Schur factorization by the eigenvalues (#8467,#9701). -
Givenstype doesn't have a size anymore and is no longer a subtype ofAbstractMatrix(#8660). -
Large speedup in sparse
\and splitting of Cholesky and LDLᵀ factorizations intocholfactandldltfact(#10117). -
Add sparse least squares to
\by addingqrfactfor sparse matrices based on the SPQR library (#10180). -
Split
Triangulartype intoUpperTriangular,LowerTriangular,UnitUpperTriagularandUnitLowerTriangular(#9779) -
OpenBLAS 64-bit (ILP64) interface is now compiled with a
64_suffix (#8734) to avoid conflicts with external libraries using a 32-bit BLAS (#4923). -
New
vecdotfunction, analogous tovecnorm, for Euclidean inner products over any iterable container (#11067). -
p = plan_fft(x)and similar functions now return aBase.DFT.Planobject, rather than an anonymous function. Calling it viap(x)is deprecated in favor ofp * xorp \ x(for the inverse), and it can also be used withA_mul_B!to employ pre-allocated output arrays (#12087). -
LU{T,Tridiagonal{T}}now supports extraction ofL,U,p, andPfactors (#12137). -
Allocations in sparse matrix factorizations are now tracked by Julia's garbage collector (#12034).
-
-
Strings
-
NUL-terminated strings should now be passed to C via the new
Cstringtype, notPtr{UInt8}orPtr{Cchar}, in order to check whether the string is free of NUL characters (which would cause silent truncation in C). The analogous typeCwstringshould be used for NUL-terminatedwchar_t*strings (#10994). -
graphemes(s)returns an iterator over grapheme substrings ofs(#9261). -
Character predicates such as
islower(),isspace(), etc. use utf8proc to provide uniform cross-platform behavior and up-to-date, locale-independent support for Unicode standards (#5939). -
reverseindfunction to convert indices in reversed strings (e.g. from reversed regex searches) to indices in the original string (#9249). -
charwidth(c)andstrwidth(s)now return up-to-date cross-platform results (via utf8proc) (#10659): Julia now likes pizza (#3721), but some terminals still don't. -
is_valid_char(c), (nowisvalid(Char,c)(#11241)), now correctly handles Unicode "non-characters", which are valid Unicode codepoints (#11171). -
Backreferences in replacement strings in calls to
replacewith aRegexpattern are now supported (#11849). Use thesstring prefix to indicate a replacement string contains a backreference. For example,replace("ab", r"(.)(.)", s"\2\1")yields "ba". -
Capture groups in regular expressions can now be named using PCRE syntax,
(?P<group_name>...). Capture group matches can be accessed by name by indexing aMatchobject with the name of the group (#11566). -
countlines()now counts all lines, not just non-empty (#11947).
-
-
Array and AbstractArray improvements
-
New multidimensional iterators and index types for efficient iteration over
AbstractArrays. Array iteration should generally be written asfor i in eachindex(A) ... endrather thanfor i = 1:length(A) ... end(#8432). -
New implementation of SubArrays with substantial performance and functionality improvements (#8501).
-
AbstractArray subtypes only need to implement
sizeandgetindexfor scalar indices to support indexing; all other indexing behaviors (including logical indexing, ranges of indices, vectors, colons, etc.) are implemented in default fallbacks. Similarly, they only need to implement scalarsetindex!to support all forms of indexed assignment (#10525). -
AbstractArrays that do not extend
similarnow return anArrayby default (#10525).
-
-
Data structures
-
New
sortperm!function for pre-allocated index arrays (#8792). -
Switch from
O(N)toO(log N)algorithm fordequeue!(pq, key)withPriorityQueue. This provides major speedups for large queues (#8011). -
PriorityQueuenow includes the order type among its parameters,PriorityQueue{KeyType,ValueType,OrderType}. An empty queue can be constructed aspq = PriorityQueue(KeyType,ValueType), if you intend to use the defaultForwardorder, orpq = PriorityQueue(KeyType, ValueType, OrderType)otherwise (#8011). -
Efficient
meanandmedianfor ranges (#8089). -
deepcopyrecurses through immutable types and makes copies of their mutable fields (#8560). -
copy(a::DArray)will now make a copy of aDArray(#9745).
-
-
New types
-
Enums are now supported through the
@enum EnumName EnumValue1 EnumValue2syntax. Enum member values also support arbitrary value assignment by the@enum EnumName EnumValue1=1 EnumValue2=10 EnumValue3=20syntax (#10168). -
New
Datesmodule for calendar dates and other time-interval calculations (#7654). -
New
Nullabletype for missing data (#8152). -
A new
Val{T}type allows one to dispatch on bits-type values (#9452). -
linspacenow returns aLinSpaceobject which lazily computes linear interpolation of values between the start and stop values. It "lifts" endpoints which are approximately rational in the same manner as thecolonoperator.
-
-
Arithmetic
-
convertnow checks for overflow when truncating integers or converting between signed and unsigned (#5413). -
Arithmetic is type-preserving for more types; e.g.
(x::Int8) + (y::Int8)now yields anInt8(#3759). -
Reductions (e.g.
reduce,sum) widen small types (integers smaller thanInt, andFloat16). -
Added optional rounding argument to floating-point constructors (#8845).
-
Equality (
==) and inequality (</<=) comparisons are now correct across all numeric types (#9133, #9198). -
Rational arithmetic throws errors on overflow (#8672).
-
Optional
logandlog1pfunctions implemented in pure Julia (experimental) (#10008). -
The
MathConsttype has been renamedIrrational(#11922). -
isapproxnow has simpler and more sensible default tolerances (#12393), supports arrays, and has synonyms≈(U+2248, LaTeX\approx) and≉(U+2249, LaTeX\napprox) forisapproxand!isapprox, respectively (#12472).
-
-
Numbers
-
Random numbers
-
Streamlined random number generation APIs #8246. The default
randno longer uses global state in the underlying C library, dSFMT, making it closer to being thread-safe (#8399, #8832). All APIs can now take anAbstractRNGargument (#8854, #9065). The seed argument tosrandis now optional (#8320, #8854). The APIs accepting a range argument are extended to accept an arbitraryAbstractArray(#9049). Passing a range ofBigInttorandorrand!is now supported (#9122). There are speed improvements across the board (#8808, #8941, #8958, #9083). -
The
randexpandrandexp!functions are exported (#9144).
-
-
File
-
Added function
readlinkwhich returns the value of a symbolic link "path" (#10714). -
Added function
ismountwhich checks if a directory is a mount point (#11279). -
The
cpfunction now accepts keyword argumentsremove_destinationandfollow_symlinks(#10888). -
The
mvfunction now accepts keyword argumentremove_destination(#11145).
-
-
Pipe()creates a bidirectional I/O object that can be passed tospawnorpipelinefor redirecting process streams (#12739). -
Other improvements
-
You can now tab-complete emoji via their short names, using
\:name:<tab>(#10709). -
gc_enablesubsumesgc_disable, and also returns the previous GC state. -
assert,@assertnow throws anAssertionErrorexception type (#9734). -
@simdnow rejects invalid control flow (@goto/ break / continue) in the inner loop body at compile time (#8624). -
The
machinefilenow supports a host count (#7616). -
code_nativenow outputs branch labels (#8897). -
Added
recvfromto get source address of UDP packets (#9418). -
ClusterManagerperformance improvements (#9309) and support for changing transports(#9434). -
Added
Base.get_process_title/Base.set_process_title(#9957). -
readavailablenow returns a byte vector instead of a string. -
New
lockandunlockfunctions, operating onReentrantLock, to lock a stream during concurrent writes from multiple tasks (#10679). -
code_llvmnow outputs stripped IR without debug info or other attached metadata. Usecode_llvm_rawfor the unstripped output (#10747). -
New
withenv(var=>val, ...) do ... endfunction to temporarily modify environment variables (#10914). -
New function
relpathreturns a relative filepath to path either from the current directory or from an optional start directory (#10893). -
mktempandmktempdirnow take an optional argument to set which directory the temporary file or directory is created in. -
New garbage collector tracked memory allocator functions:
jl_malloc,jl_calloc,jl_realloc, andjl_freewith libc API ([#12034]). -
mktempdirandmktempnow have variants that take a function as its first argument for automated clean-up ([#9017]).
-
Deprecated or removed
-
several syntax whitespace insensitivities have been deprecated (#11891).
# function call f (x) # getindex x [17] rand(2) [1] # function definition f (x) = x^2 function foo (x) x^2 end -
indexing with
Reals that are not subtypes ofInteger(Rational,AbstractFloat, etc.) has been deprecated (#10458). -
push!(A)has been deprecated, useappend!instead of splatting arguments topush!(#10400). -
namesfor composite datatypes has been deprecated and renamed tofieldnames(#10332). -
DArrayfunctionality has been removed fromBaseand is now a standalone package under the JuliaParallel umbrella organization (#10333). -
The
Graphicsmodule has been removed fromBaseand is now a standalone package (#10150, #9862). -
The
Woodburyspecial matrix type has been removed fromLinAlg(#10024). -
medianandmedian!no longer accept achecknankeyword argument (#8605). -
infandnanare now deprecated in favor ofT(Inf)andT(NaN), respectively (#8776). -
oftype(T::Type, x)is deprecated in favor ofconvert(T,x)(orT(x)). -
{...}syntax is deprecated in favor ofAny[...](#8578). -
itrunc,ifloor,iceilandiroundare deprecated in favour oftrunc{T<:Integer}(T,x),floor{T<:Integer}(T,x), etc..truncis now always bound-checked;Base.unsafe_truncprovides the old uncheckeditruncbehaviour (#9133). -
squeezenow requires that passed dimension(s) are anIntor tuple ofInts; callingsqueezewith an arbitrary iterator is deprecated (#9271). Additionally, passed dimensions must be unique and correspond to extant dimensions of the input array. -
randboolis deprecated. Userand(Bool)to produce a random boolean value, andbitrandto produce a random BitArray (#9105, #9569). -
beginswithis renamed tostartswith(#9578). -
nullis renamed tonullspace(#9714). -
The operators
|>,.>,>>, and.>>as used for process I/O redirection are replaced with thepipelinefunction (#5349, #12739). -
flipud(A)andfliplr(A)have been deprecated in favor offlipdim(A, 1)andflipdim(A, 2), respectively (#10446). -
Numeric conversion functions whose names are lower-case versions of type names have been removed. To convert a scalar, use the type name, e.g.
Int32(x). To convert an array to a different element type, useArray{T}(x),map(T,x), orround(T,x). To parse a string as an integer or floating-point number, useparse(#1470, #6211). -
Low-level functions from the C library and dynamic linker have been moved to modules
LibcandLibdl, respectively (#10328). -
The functions
parseint,parsefloat,float32_isvalid,float64_isvalid, and the string-argumentBigIntandBigFloathave been replaced byparseandtryparsewith a type argument. The string macrobig"xx"can be used to constructBigIntandBigFloatliterals (#3631, #5704, #9487, #10543, #10955). -
the
--int-literalscompiler option is no longer accepted (#9597). -
Instead of
linrange, uselinspace(#9666). -
The functions
is_valid_char,is_valid_ascii,is_valid_utf8,is_valid_utf16, andis_valid_utf32have been replaced by genericisvalidmethods. The single argument formisvalid(value)can now be used for values of typeChar,ASCIIString,UTF8String,UTF16StringandUTF32String. The two argument formisvalid(type, value)can be used with the above types, with values of typeVector{UInt8},Vector{UInt16},Vector{UInt32}, andVector{Char}(#11241). -
Instead of
utf32(64,123,...)useutf32(UInt32[64,123,...])(#11379). -
start_timerandstop_timerare replaced byTimerandclose. -
The following internal julia C functions have been renamed, in order to prevent potential naming conflicts with C libraries: (#11741)
-
gc_wb*->jl_gc_wb* -
gc_queue_root->jl_gc_queue_root -
allocobj->jl_gc_allocobj -
alloc_[0-3]w->jl_gc_alloc_*w -
diff_gc_total_bytes->jl_gc_diff_total_bytes -
sync_gc_total_bytes->jl_gc_sync_total_bytes
-
-
require(::AbstractString)andreload(see news about addition ofcompile). -
cartesianmapis deprecated in favor of iterating over aCartesianRange
Julia v0.3.0 Release Notes
New language features
-
Greatly enhanced performance for passing and returning
Tuples (#4042). -
Tuples (ofIntegers,Symbols, orBools) can now be used as type parameters (#5164). -
An additional default "inner" constructor accepting any arguments is now generated. Constructors that look like
MyType(a, b) = new(a, b)do not need to be added manually (#4026, #7071). -
Expanded array type hierarchy to include an abstract
DenseArrayfor in-memory arrays with standard strided storage (#987, #2345, #6212). -
When reloading code, types whose definitions have not changed can be ignored in some cases.
-
Binary
~now parses as a vararg macro call to@~. For examplex~y~z=>@~ x y z(#4882). -
Structure fields can now be accessed by index (#4806).
-
If a module contains a function
__init__(), it will be called when the module is first loaded, and on process startup if a pre-compiled version of the module is present (#1268). -
--check-bounds=yes|nocompiler option -
Unicode identifiers are normalized (NFC) so that different encodings of equivalent strings are treated as the same identifier (#5462).
-
The set of characters permitted in identifiers has been restricted based on Unicode categories. Generally, punctuation, formatting and control characters, and operator symbols are not allowed in identifiers. Number-like characters cannot begin identifiers (#5936).
-
Define a limited number of infix Unicode operators (#552, #6582):
Precedence class Operators (with synonyms, if any) == ≥ (>=) ≤ (<=) ≡ (===) ≠ (!=) ≢ (!==) .≥ (.>=) .≤ (.<=) .!= (.≠) ∈ ( in) ∉ ((x,y)->!in(x, y)) ∋ ((x,y)->in(y, x)) ∌ ((x,y)->!in(y, x)) ⊆ (issubset) ⊈ ((x,y)->!issubset(x, y)) ⊊ ((x,y)->x⊆y && x!=y)+ ∪ ( union)* ÷ ( div) ⋅ (dot) × (cross) ∩ (intersect)unary √ ∛ In addition to these, many of the Unicode operator symbols are parsed as infix operators and are available for user-defined methods (#6929).
-
Improved reporting of syntax errors (#6179)
-
breakinside aforloop with multiple ranges now exits the entire loop nest (#5154) -
Local goto statements using the
@gotoand@labelmacros (#101).
REPL improvements
-
New native-Julia REPL implementation, eliminating many problems stemming from the old GNU Readline-based REPL (#6270).
-
Tab-substitution of LaTeX math symbols (e.g.
\alphabyα) (#6911). This also works in IJulia and in Emacs (#6920). -
workspace()function for obtaining a fresh workspace (#1195).
Library improvements
-
isequalnow compares all numbers by value, ignoring type (#6624). -
Implement limited shared-memory parallelism with
SharedArrays (#5380). -
Well-behaved floating-point ranges (#2333, #5636). Introduced the
FloatRangetype for floating-point ranges with a step, which will give intuitive/correct results for classically problematic ranges like0.1:0.1:0.3,0.0:0.7:2.1or1.0:1/49:27.0. -
New functions
minmaxandextrema(#5275). -
New macros
@edit,@less,@code_typed,@code_lowered,@code_llvmand@code_nativethat all function like@which(#5832). -
consume(p)extended toconsume(p, args...), allowing it to optionally passargs...back to the producer (#4775). -
.juliarc.jlis now loaded for both script and REPL execution (#5076). -
The
Sysmodule now includes convenient functions for working with dynamic library handles;Sys.dllistwill list out all paths currently loaded viadlopen, andSys.dlpathwill lookup a path from a handle -
readdlmtreats multiple whitespace characters as a single delimiter by default (when no delimiter is specified). This is useful for reading fixed-width or messy whitespace-delimited data (#5403). -
The Airy, Bessel, Hankel, and related functions (
airy*,bessel*,hankel*) now detect errors returned by the underlying AMOS library, throwing anAmosExceptionin that case (#4967). -
methodswithnow returns an array ofMethods (#5464) rather than just printing its results. -
errno([code])function to get or set the C library'serrno. -
GitHubmodule for interacting with the GitHub API. -
Package improvements
-
Packages are now installed into
.julia/v0.3by default (or whatever the current Julia version is), so that different versions of Julia can co-exist with incompatible packages. Existing.juliainstallations are unaffected unlessPkg.init()is run to re-create the package directories (#3344, #5737). -
Pkg.submit(pkg[,commit])function to automatically submit a GitHub pull request to the package author.
-
-
Collections improvements
-
Arrayassignment (e.g.x[:] = y) ignores singleton dimensions and allows the last dimension of one side to match all trailing dimensions of the other (#4048, #4383). -
Dict(kv)constructor for any iterator on(key,value)pairs. -
Multi-key
Dicts:D[x,y...]is now a synonym forD[(x,y...)]for associationsD(#4870). -
push!andunshift!can push multiple arguments (#4782). -
writedlmandwritecsvnow accept any iterable collection of iterable rows, in addition toAbstractArrayarguments, and thewritedlmdelimiter can be any printable object (e.g. aString) instead of just aChar. -
isemptynow works for any iterable collection (#5827). -
uniquenow accepts an optionaldimargument for finding unique rows or columns of a matrix or regions of a multidimensional array (#5811).
-
-
Numberimprovements-
The
ImaginaryUnittype no longer exists. Instead,imis of typeComplex{Bool}. Making this work required changing the semantics of boolean multiplication to approximately,true * x = xandfalse * x = zero(x), which can itself be considered useful (#5468). -
bigis now vectorized (#4766) -
nextpowandprevpownow return thea^nvalues instead of the exponentn(#4819) -
Overflow detection in
parseint(#4874). -
randnow supports arbitraryRangesarguments (#5059). -
expm1andlog1pnow support complex arguments (#3141). -
Broadcasting
.//is now included (#7094). -
prevfloatandnextfloatnow saturate at -Inf and Inf, respectively, and have otherwise been fixed to follow the IEEE-754 standard functionsnextDownandnextUp(#5025). -
New function
widenfor widening numeric types and values, andwidemulfor multiplying to a larger type (#6169). -
polygamma,digamma, andtrigammanow accept complex arguments, andzeta(s, z)now provides the Hurwitz zeta (#7125). -
Narrow integer types (< 32 bits) are promoted to
Float64rather than toFloat32byfloat(x)(#7390).
-
-
Stringimprovements-
Triple-quoted regex strings,
r"""..."""(#4934). -
New string type,
UTF16String(#4930), constructed byutf16(s)from another string, aUint16array or pointer, or a byte array (possibly prefixed by a byte-order marker to indicate endian-ness). Its data is internallyNULL-terminated for passing to C (#7016). -
CharStringis renamed toUTF32String(#4943), and its data is now internallyNULL-terminated for passing to C (#7016).CharString(c::Char...)is deprecated in favor ofutf32(c...), andutf32(s)otherwise has functionality similar toutf16(s). -
New
WStringandwstringsynonyms for eitherUTF16Stringandutf16orUTF32Stringandutf32, respectively, depending on the width ofCwchar_t(#7016). -
normalize_stringfunction to perform Unicode normalization, case-folding, and other transformations (#5576). -
pointer(s, i=1)forByteString,UTF16String,UTF32String, andSubStrings thereof (#5703). -
bytestringis automatically called onStringarguments for conversion toPtr{Uint8}inccall(#5677).
-
-
Linear algebra improvements
-
Balancing options for eigenvector calculations for general matrices (#5428).
-
Mutating linear algebra functions no longer promote (#5526).
-
condskeelfor Skeel condition numbers (#5726). -
norm(::Matrix)no longer calculates a vector norm when the first dimension is one (#5545); it always uses the operator (induced) matrix norm. -
New
vecnorm(itr, p=2)function that computes the norm of any iterable collection of numbers as if it were a vector of the same length. This generalizes and replacesnormfro(#6057), andnormis now type-stable (#6056). -
New
UniformScalingmatrix type and identityIconstant (#5810). -
None of the concrete matrix factorization types are exported from
Baseby default anymore. -
Sparse linear algebra
-
1-d sparse
getindexhas been implemented (#7047) -
Faster sparse
getindex(#7131). -
Faster sparse
kron(#4958). -
sparse(A) \ Bnow supports a matrixBof right-hand sides (#5196). -
eigs(A, sigma)now uses shift-and-invert for nonzero shiftssigmaand inverse iteration forwhich="SM". Ifsigma==nothing(the new default), computes ordinary (forward) iterations (#5776). -
sprandis faster, and whether any entry is nonzero is now determined independently with the specified probability (#6726).
-
-
Dense linear algebra for special matrix types
-
Interconversions between the special matrix types
Diagonal,Bidiagonal,SymTridiagonal,Triangular, andTriangular, andMatrixare now allowed for matrices which are representable in both source and destination types (5e3f074b). -
Allow for addition and subtraction over mixed matrix types, automatically promoting the result to the denser matrix type (a448e080, #5927)
-
new algorithms for linear solvers and eigensystems of
Bidiagonalmatrices of generic element types (#5277) -
new algorithms for linear solvers, eigensystems and singular systems of
Diagonalmatrices of generic element types (#5263) -
new algorithms for linear solvers and eigensystems of
Triangularmatrices of generic element types (#5255) -
specialized
invanddetmethods forTridiagonalandSymTridiagonalbased on recurrence relations between principal minors (#5358) -
specialized
transpose,ctranspose,istril,istriumethods forTriangular(#5255) andBidiagonal(#5277) -
new LAPACK wrappers
- condition number estimate
cond(A::Triangular)(#5255)
- condition number estimate
-
parametrize
Triangularon matrix type (#7064) -
Lyapunov / Sylvester solver (#7435)
-
eigvalsforSymmetric,TridiagonalandHermitianmatrices now support additional method signatures: (#3688, #6652, #6678, #7647)eigvals(M, el, eu)finds all eigenvalues in the interval(el, eu]eigvals(M, il:iu)finds theilth through theiuth eigenvalues (in ascending order)
-
-
Dense linear algebra for generic matrix element types
-
-
New function
deleteat!deletes a specified index or indices and returns the updated collection -
The
setenvfunction for external processes now accepts adirkeyword argument for specifying the directory to start the child process in (#4888). -
Constructors for collections (
Set,Dict, etc.) now generally accept a single iterable argument giving the elements of the collection (#4996, #4871) -
Ranges and arrays with the same elements are now unequal. This allows hashing and comparing ranges to be faster (#5778).
-
Broadcasting now works on arbitrary
AbstractArrays(#5387) -
Reduction functions that accept a pre-allocated output array, including
sum!,prod!,maximum!,minimum!,all!,any!(#6197, #5387) -
Faster performance on
fill!andcopy!for array types not supporting efficient linear indexing (#5671, #5387) -
Changes to range types (#5585)
-
Rangeis now the abstract range type, instead ofRanges -
New function
rangefor constructing ranges by length -
Rangeis nowStepRange, andRange1is nowUnitRange. Their constructors accept end points instead of lengths. Both are subtypes of a new abstract typeOrdinalRange. -
Ranges now support
BigIntand general ordinal types. -
Very large ranges (e.g.
0:typemax(Int)) can now be constructed, but some operations (e.g.length) will raise anOverflowError.
-
-
Extended API for
covandcor, which accept keyword argumentsvardim,corrected, andmean(#6273) -
New functions
randsubseqandrandsubseq!to create a random subsequence of an array (#6726) -
New macro
@evalpolyfor efficient inline evaluation of polynomials (#7146). -
The signal filtering function
filtnow accepts an optional initial filter state vector. A new in-place functionfilt!is also exported (#7513). -
Significantly faster
cumsumandcumprod(#7359). -
Implement
findminandfindmaxover specified array dimensions (#6716). -
Support memory-mapping of files with offsets on Windows (#7242).
-
Catch writes to protect memory, such as when trying to modify a mmapped file opened in read-only mode (#3434).
Environment improvements
-
New
--code-coverageand--track-allocationstartup features allow one to measure the number of executions or the amount of memory allocated, respectively, at each line of code (#5423,#7464). -
Profile.initnow accepts keyword arguments, and returns the current settings when no arguments are supplied (#7365).
Build improvements
- Dependencies are now verified against stored MD5/SHA512 hashes, to ensure that the correct file has been downloaded and was not modified (#6773).
Deprecated or removed
-
convert(Ptr{T1}, x::Array{T2})is now deprecated unlessT1 == T2orT1 == Void(#6073). (You can still explicitlyconvertone pointer type into another if needed.) -
Sys.shlib_exthas been renamed toSys.dlext -
denseis deprecated in favor offull(#4759). -
The
Stattype is renamedStatStruct(#4670). -
setrounding,roundingandsetroundingnow take an additional argument specifying the floating point type to which they apply. The old behaviour and[get/set/with]_bigfloat_roundingfunctions are deprecated (#5007). -
cholpfactandqrpfactare deprecated in favor of keyword arguments incholfact(..., pivot=true)andqrfact(..., pivot=true)(#5330). -
symmetrize!is deprecated in favor ofBase.LinAlg.copytri!(#5427). -
myindexeshas been renamed tolocalindexes(#5475). -
factorize!is deprecated in favor offactorize(#5526). -
nnzcounts the number of structural nonzeros in a sparse matrix. Usecountnzfor the actual number of nonzeros (#6769). -
setfieldis renamedsetfield!(#5748). -
putandtakeare renamedput!andtake!(#5511). -
put!now returns its first argument, the remote reference (#5819). -
readmethods that modify a passed array are now calledread!(#5970) -
infsandnansare deprecated in favor of the more generalfill. -
*anddivare no longer supported forChar. -
Rangeis renamedStepRangeandRange1is renamedUnitRange.Rangesis renamedRange. -
bitmixis replaced by a 2-argument form ofhash. -
readsfromandwritestoare replaced byopen(#6948). -
insert!now throws aBoundsErrorifindex > length(collection)+1(#7373). -
No longer exported from
Base:start_reading,stop_reading,start_watching(#10885).
Julia v0.2.0 Release Notes
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.
New language features
-
Immutable types (#13).
-
Triple-quoted string literals (#70).
-
New infix operator
in(e.g.x in S), and corresponding functionin(x,S), replacingcontains(S,x)function (#2703). -
New variable bindings on each for loop and comprehension iteration (#1571). For example, before this change:
julia> map(f->f(), { ()->i for i=1:3 }) 3-element Any Array: 3 3 3and after:
julia> map(f->f(), { ()->i for i=1:3 }) 3-element Any Array: 1 2 3 -
Explicit relative importing (#2375).
-
Methods can be added to functions in other modules using dot syntax, as in
Foo.bar(x) = 0. -
import module: name1, name2, ...(#5214). -
A semicolon is now allowed after an
importorusingstatement (#4130). -
In an interactive session (REPL), you can use
;cmdto runcmdvia an interactive shell. For example:julia> ;ls CONTRIBUTING.md Makefile VERSION cli/ deps/ julia@ DISTRIBUTING.md NEWS.md Windows.inc doc/ src/ usr/ LICENSE.md README.md base/ etc/ test/ Make.inc README.windows.md contrib/ examples/ tmp/
New library functions
-
Sampling profiler (#2597).
-
Functions for examining stages of the compiler's output:
code_lowered,code_typed,code_llvm, andcode_native. -
Multimedia I/O API (display, writemime, etcetera) (#3932).
-
MPFR-based
BigFloat(#2814), and many newBigFloatoperations. -
New half-precision IEEE floating-point type,
Float16(#3467). -
Support for setting floating-point rounding modes (#3149).
-
methodswithshows all methods with an argument of specific type. -
mapslicesprovides a general way to perform operations on slices of arrays (#2204). -
repeatfunction for constructing Arrays with repeated elements (#3605). -
Collections.PriorityQueuetype andCollections.heapfunctions (#2920). -
quadgk1d-integration routine (#3140). -
erfinvanderfcinvfunctions (#2987). -
varm,stdm(#2265). -
digamma,invdigamma,trigammaandpolygammafor calculating derivatives ofgammafunction (#3233). -
logdet(#3070). -
Names for C-compatible types:
Cchar,Clong, etc. (#2370). -
cglobalto access global variables (#1815). -
unsafe_pointer_to_objref(#2468) andpointer_from_objref(#2515). -
readandwritefor external processes. -
I/O functions
readbytesandreadbytes!(#3878). -
flush_cstdiofunction (#3949). -
ClusterManager makes it possible to support different types of compute clusters (#3649, #4014).
-
rmprocsfor removing processors from a parallel computing session. The system can also tolerate to some extent processors that die unexpectedly (#3050). -
interruptfor interrupting worker processes (#3819). -
timedwaitdoes a polled wait for an event till a specified timeout. -
Conditiontype withwaitandnotifyfunctions forTasksynchronization. -
versioninfoprovides detailed version information, especially useful when reporting and diagnosing bugs. -
detachfor running child processes in a separate process group. -
setenvfor passing environment variables to child processes. -
ifelseeagerly-evaluated conditional function, especially useful for vectorized conditionals.
Library improvements
-
isequalnow returnsfalsefor numbers of different types. This makes it much easier to define hashing for new numeric types. Uses ofDictwith numeric keys might need to change to account for this increased strictness. -
A redesigned and rewritten
Pkgsystem is much more robust in case of problems. The basic interface to adding and removing package requirements remains the same, but great deal of additional functionality for developing packages in-place was added. See the new packages chapter in the manual for further details. -
Sorting API updates (#3665) – see sorting functions.
-
The
delete!(d::Dict, key)function has been split into separatepop!anddelete!functions (#3439).pop!(d,key)removeskeyfromdand returns the value that was associated with it; it throws an exception ifddoes not containkey.delete!(d,key)removeskeyfromdand succeeds regardless of whetherdcontainedkeyor not, returningditself in either case. -
Linear-algebra factorization routines (
lu,chol, etc.) now returnFactorizationobjects (andlud,chold, etc. are deprecated; #2212). -
A number of improvements to sparse matrix capabilities and sparse linear algebra.
-
More linear algebra fixes and eigensolver hooks for
SymTridiagonal,TridiagonalandBidiagonalmatrix types (#2606, #2608, #2609, #2611, #2678, #2713, #2720, #2725). -
Change
integer_valued,real_valued, and so on toisinteger,isreal, and so on, and semantics of the later are now value-based rather than type-based, unlike MATLAB/Octave (#3071).isboolandiscomplexare eliminated in favor of a generaliseltypefunction. -
Transitive comparison of floats with rationals (#3102).
-
Fast prime generation with
primesand fast primality testing withisprime. -
sumandcumsumnow use pairwise summation for better accuracy (#4039). -
Dot operators (
.+,.*etc.) now broadcast singleton dimensions of array arguments. This behavior can be applied to any function usingbroadcast(f, ...). -
combinations,permutations, andpartitionsnow return iterators instead of a task, andinteger_partitionshas been renamed topartitions(#3989, #4055). -
isreadable/iswritablemethods added for more IO types (#3872). -
Much faster and improved
readdlmandwritedlm(#3350, #3468, #3483). -
Faster
matchall(#3719), and various string and regex improvements. -
Documentation of advanced linear algebra features (#2807).
-
Support optional RTLD flags in
dlopen(#2380). -
pmapnow works with any iterable collection. -
Options in
pmapfor retrying or ignoring failed tasks. -
New
sinpi(x)andcospi(x)functions to compute sine and cosine ofpi*xmore accurately (#4112). -
New implementations of elementary complex functions
sqrt,log,asin,acos,atan,tanh,asinh,acosh,atanhwith correct branch cuts (#2891). -
Improved behavior of
SubArray(#4412, #4284, #4044, #3697, #3790, #3148, #2844, #2644 and various other fixes). -
New convenience functions in graphics API.
-
Improved backtraces on Windows and OS X.
-
Implementation of reduction functions (including
reduce,mapreduce,sum,prod,maximum,minimum,all, andany) are refactored, with improved type stability, efficiency, and consistency (#6116, #7035, #7061, #7106).
Deprecated or removed
-
Methods of
minandmaxthat do reductions were renamed tominimumandmaximum.min(x)is nowminimum(x), andmin(x,(),dim)is nowminimum(x,dim)(#4235). -
ComplexPairwas renamed toComplexand madeimmutable, andComplex128and so on are now aliases to the newComplextype. -
!was added to the name of many mutating functions, e.g.,pushwas renamedpush!(#907). -
refrenamed togetindex, andassigntosetindex!(#1484). -
writeablerenamed towritable(#3874). -
logbandilogbrenamed toexponent(#2516). -
quote_stringbecame a method ofrepr. -
safe_char,check_ascii, andcheck_utf8replaced byis_valid_char,is_valid_ascii, andis_valid_utf8, respectively. -
each_line,each_match,begins_with,ends_with,parse_float,parse_int, andseek_endreplaced by:eachline,eachmatch, and so on (_was removed) (#1539). -
parse_bin(s)replaced byparseint(s,2);parse_oct(s)replaced byparseint(s,8);parse_hex(s)replaced byparseint(s,16). -
findn_nzsreplaced byfindnz(#1539). -
DivideByZeroErrorreplaced byDivideError. -
addprocs_ssh,addprocs_ssh_tunnel, andaddprocs_localreplaced byaddprocs(with keyword options). -
remote_call,remote_call_fetch, andremote_call_waitreplaced byremotecall,remotecall_fetch, andremotecall_wait. -
hasreplaced byinfor sets and byhaskeyfor dictionaries. -
diagmmanddiagmm!replaced byscaleandscale!(#2916). -
unsafe_refandunsafe_assignreplaced byunsafe_loadandunsafe_store!. -
add_each!anddel_each!replaced byunion!andsetdiff!. -
isdenormalrenamed toissubnormal(#3105). -
exprreplaced by direct call toExprconstructor. -
|,&,$,-, and~for sets replaced byunion,intersect,symdiff,setdiff, andcomplement(#3272). -
squarefunction removed. -
pascalfunction removed. -
addandadd!forSetreplaced bypush!. -
lsfunction deprecated in favor ofreaddiror;lsin the REPL. -
start_timernow expects arguments in units of seconds, not milliseconds. -
Shell redirection operators
|,>, and<eliminated in favor of a new operator|>(#3523). -
amapis deprecated in favor of newmapslicesfunctionality. -
The
Reverseiterator was removed since it did not work in many cases. -
The
gcdfunction now returns a non-negative value regardless of the argument signs, and various other sign problems withinvmod,lcm,gcdx, andpowermodwere fixed (#4811).
Miscellaneous changes
-
julia-release-*executables renamed tojulia-*, andlibjulia-releaserenamed tolibjulia(#4177). -
Packages will now be installed in
.julia/vX.Y, where X.Y is the current Julia version.
Bugfixes and performance updates
Too numerous to mention.