Julia v1.7 Release Notes
New language features
- (; a, b) = xcan now be used to destructure properties- aand- bof- x. This syntax is equivalent to- a = 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).
- The default behavior of observing @inboundsdeclarations is now an option viaautoin--check-bounds=yes|no|auto(#41551)
Language changes
- macroexpand,- @macroexpand, and- @macroexpand1no longer wrap errors in a- LoadError. 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 returns- nothingwhen- itris empty instead of throwing a- BoundsError(#39607).
- Multiple successive semicolons in an array expresion were previously ignored (e.g., [1 ;; 2] == [1 ; 2]). This syntax is now used to separate dimensions (see New language features).
- Unbalanced Unicode bidirectional formatting directives are now disallowed within strings and comments, to mitigate the "trojan source" vulnerability (#42918).
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 if- xis a value that is normally unordered, such as- NaNor- missing(#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).
- bytes2hexand- hex2bytesare no longer limited to arguments of type- Union{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-friendly- showmethod (#39463).
Standard library changes
- countand- findallnow accept an- AbstractCharargument to search for a character in a string (#38675).
- New methods range(start, stop)andrange(start, stop, length)(#39228).
- rangenow supports- startas 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).
- islowercaseand- isuppercaseare now compliant with the Unicode lower/uppercase categories (#38574).
- isevenand- isoddfunctions now support non-- Integernumeric types (#38976).
- escape_stringnow accepts a collection of characters via the keyword- keepthat are to be kept as they are (#38597).
- getindexfor- NamedTuples 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 of- textwidth(#39044).
- Test.@testnow accepts- brokenand- skipboolean keyword arguments, which mimic- Test.@test_brokenand- Test.@test_skipbehavior, but allows skipping tests failing only under certain conditions. For example
 can be replaced by- if 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).
- The lengthfunction on certain ranges of certain specific 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)
- 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, and- freenow 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 supports- UniformScalingwith- AbstractMatrix(#40250).
- qr[!]and- lu[!]now support- LinearAlgebra.PivotingStrategy(singleton type) values as their optional- pivotargument: defaults are- qr(A, NoPivot())(vs.- qr(A, ColumnNorm())for pivoting) and- lu(A, RowMaximum())(vs.- lu(A, NoPivot())without pivoting); the former- Val{true/false}-based calls are deprecated (#40623).
- det(M::AbstractMatrix{BigInt})now calls- det_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 associated- README.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 checking- issparseon 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 that- Tar.createdoes, which is, in turn the same way that- gitnormalizes 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 neccessary, 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 Solaris- tarcommands 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 a- set_permissionskeyword argument, which defaults to- true; if- falseis 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 to- use_mmap=falseon all OSes for consistent reliability in abnormal filesystem situations (#40415).