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))(#32753). pkgdir(ModuleName)now provides a simpler way to return the package root directory of a module (or submodule) than the typically useddirname(dirname(pathof(ModuleName)))(#33128).
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)