|
| 1 | +Julia v1.12 Release Notes |
| 2 | +======================== |
| 3 | + |
| 4 | +New language features |
| 5 | +--------------------- |
| 6 | + |
| 7 | +- New option `--trim` creates smaller binaries by removing code that was not proven to be reachable from |
| 8 | + the entry points. Entry points can be marked using `Base.Experimental.entrypoint` ([#55047]). |
| 9 | +- A new keyword argument `usings::Bool` has been added to `names`. By using this, we can now |
| 10 | + find all the names available in module `A` by `names(A; all=true, imported=true, usings=true)`. ([#54609]) |
| 11 | +- the `@atomic(...)` macro family supports now the reference assignment syntax, e.g. |
| 12 | + `@atomic :monotonic v[3] += 4` modifies `v[3]` atomically with monotonic ordering semantics. ([#54707]) |
| 13 | + The supported syntax allows |
| 14 | + - atomic fetch (`x = @atomic v[3]`), |
| 15 | + - atomic set (`@atomic v[3] = 4`), |
| 16 | + - atomic modify (`@atomic v[3] += 2`), |
| 17 | + - atomic set once (`@atomiconce v[3] = 2`), |
| 18 | + - atomic swap (`x = @atomicswap v[3] = 2`), and |
| 19 | + - atomic replace (`x = @atomicreplace v[3] 2=>5`). |
| 20 | +- New option `--task-metrics=yes` to enable the collection of per-task timing information, |
| 21 | + which can also be enabled/disabled at runtime with `Base.Experimental.task_metrics(::Bool)`. ([#56320]) |
| 22 | + The available metrics are: |
| 23 | + - actual running time for the task (`Base.Experimental.task_running_time_ns`), and |
| 24 | + - wall-time for the task (`Base.Experimental.task_wall_time_ns`). |
| 25 | +- Support for Unicode 16 ([#56925]). |
| 26 | +- `Threads.@spawn` now takes a `:samepool` argument to specify the same threadpool as the caller. |
| 27 | + `Threads.@spawn :samepool foo()` which is shorthand for `Threads.@spawn Threads.threadpool() foo()` ([#57109]) |
| 28 | + |
| 29 | +Language changes |
| 30 | +---------------- |
| 31 | + |
| 32 | + - Julia now defaults to 1 "interactive" thread, in addition to the 1 "default" worker thread. i.e. `-t1,1` |
| 33 | + This means in default configuration the main task and repl (when in interactive mode), which both run on |
| 34 | + thread 1, now run within the `interactive` threadpool. Also the libuv IO loop runs on thread 1, |
| 35 | + helping efficient utilization of the "default" worker threadpool, which is what `Threads.@threads` and a bare |
| 36 | + `Threads.@spawn` uses. Use `0` to disable the interactive thread i.e. `-t1,0` or `JULIA_NUM_THREADS=1,0`, or |
| 37 | + `-tauto,0` etc. The zero is explicitly required to disable it, `-t2` will set the equivalent of `-t2,1` ([#57087]) |
| 38 | + |
| 39 | + - When methods are replaced with exactly equivalent ones, the old method is no |
| 40 | + longer deleted implicitly simultaneously, although the new method does take |
| 41 | + priority and become more specific than the old method. Thus if the new |
| 42 | + method is deleted later, the old method will resume operating. This can be |
| 43 | + useful to mocking frameworks (such as in SparseArrays, Pluto, and Mocking, |
| 44 | + among others), as they do not need to explicitly restore the old method. |
| 45 | + While inference and compilation still must be repeated with this, it also |
| 46 | + may pave the way for inference to be able to intelligently re-use the old |
| 47 | + results, once the new method is deleted. ([#53415]) |
| 48 | + |
| 49 | + - Macro expansion will no longer eagerly recurse into `Expr(:toplevel)` |
| 50 | + expressions returned from macros. Instead, macro expansion of `:toplevel` |
| 51 | + expressions will be delayed until evaluation time. This allows a later |
| 52 | + expression within a given `:toplevel` expression to make use of macros |
| 53 | + defined earlier in the same `:toplevel` expression. ([#53515]) |
| 54 | + |
| 55 | + - Trivial infinite loops (like `while true; end`) are no longer undefined |
| 56 | + behavior. Infinite loops that actually do things (e.g. have side effects |
| 57 | + or sleep) were never and are still not undefined behavior. ([#52999]) |
| 58 | + |
| 59 | + - It is now an error to mark a binding as both `public` and `export`ed. |
| 60 | + ([#53664]) |
| 61 | + |
| 62 | +Compiler/Runtime improvements |
| 63 | +----------------------------- |
| 64 | + |
| 65 | +- Generated LLVM IR now uses actual pointer types instead of passing pointers as integers. |
| 66 | + This affects `llvmcall`: Inline LLVM IR should be updated to use `i8*` or `ptr` instead of |
| 67 | + `i32` or `i64`, and remove unneeded `ptrtoint`/`inttoptr` conversions. For compatibility, |
| 68 | + IR with integer pointers is still supported, but generates a deprecation warning. ([#53687]) |
| 69 | + |
| 70 | +- A new exception `FieldError` is now introduced to raise/handle `getfield` exceptions. Previously `getfield` exception was captured by fallback generic exception `ErrorException`. Now that `FieldError` is more specific `getfield` related exceptions that can occur should use `FieldError` exception instead. ([#54504]) |
| 71 | + |
| 72 | +Command-line option changes |
| 73 | +--------------------------- |
| 74 | + |
| 75 | +* The `-m/--module` flag can be passed to run the `main` function inside a package with a set of arguments. |
| 76 | + This `main` function should be declared using `@main` to indicate that it is an entry point. ([#52103]) |
| 77 | +* Enabling or disabling color text in Julia can now be controlled with the |
| 78 | + [`NO_COLOR`](https://no-color.org/) or [`FORCE_COLOR`](https://force-color.org/) environment |
| 79 | + variables. These variables are also honored by Julia's build system ([#53742], [#56346]). |
| 80 | +* `--project=@temp` starts Julia with a temporary environment. ([#51149]) |
| 81 | +* New `--trace-compile-timing` option to report how long each method reported by `--trace-compile` took |
| 82 | + to compile, in ms. ([#54662]) |
| 83 | +* `--trace-compile` now prints recompiled methods in yellow or with a trailing comment if color is not supported ([#55763]) |
| 84 | +* New `--trace-dispatch` option to report methods that are dynamically dispatched ([#55848]). |
| 85 | + |
| 86 | +Multi-threading changes |
| 87 | +----------------------- |
| 88 | + |
| 89 | +* New types are defined to handle the pattern of code that must run once per process, called |
| 90 | + a `OncePerProcess{T}` type, which allows defining a function that should be run exactly once |
| 91 | + the first time it is called, and then always return the same result value of type `T` |
| 92 | + every subsequent time afterwards. There are also `OncePerThread{T}` and `OncePerTask{T}` types for |
| 93 | + similar usage with threads or tasks. ([#55793]) |
| 94 | + |
| 95 | +Build system changes |
| 96 | +-------------------- |
| 97 | + |
| 98 | +* There are new `Makefile`s to build Julia and LLVM using the Binary Optimization and Layout Tool (BOLT), see `contrib/bolt` and `contrib/pgo-lto-bolt` ([#54107]). |
| 99 | + |
| 100 | +New library functions |
| 101 | +--------------------- |
| 102 | + |
| 103 | +* `logrange(start, stop; length)` makes a range of constant ratio, instead of constant step ([#39071]) |
| 104 | +* The new `isfull(c::Channel)` function can be used to check if `put!(c, some_value)` will block. ([#53159]) |
| 105 | +* `waitany(tasks; throw=false)` and `waitall(tasks; failfast=false, throw=false)` which wait multiple tasks at once ([#53341]). |
| 106 | +* `uuid7()` creates an RFC 9652 compliant UUID with version 7 ([#54834]). |
| 107 | +* `insertdims(array; dims)` allows to insert singleton dimensions into an array which is the inverse operation to `dropdims`. ([#45793]) |
| 108 | +* The new `Fix` type is a generalization of `Fix1/Fix2` for fixing a single argument ([#54653]). |
| 109 | +* `Sys.detectwsl()` allows to testing if Julia is running inside WSL at runtime. ([#57069]) |
| 110 | + |
| 111 | +New library features |
| 112 | +-------------------- |
| 113 | + |
| 114 | +* `escape_string` takes additional keyword arguments `ascii=true` (to escape all |
| 115 | + non-ASCII characters) and `fullhex=true` (to require full 4/8-digit hex numbers |
| 116 | + for u/U escapes, e.g. for C compatibility) ([#55099]). |
| 117 | +* `tempname` can now take a suffix string to allow the file name to include a suffix and include that suffix in |
| 118 | + the uniquing checking ([#53474]) |
| 119 | +* `RegexMatch` objects can now be used to construct `NamedTuple`s and `Dict`s ([#50988]) |
| 120 | +* `Lockable` is now exported ([#54595]) |
| 121 | +* `Base.require_one_based_indexing` and `Base.has_offset_axes` are now public ([#56196]) |
| 122 | +* New `ltruncate`, `rtruncate` and `ctruncate` functions for truncating strings to text width, accounting for char widths ([#55351]) |
| 123 | +* `isless` (and thus `cmp`, sorting, etc.) is now supported for zero-dimensional `AbstractArray`s ([#55772]) |
| 124 | +* `invoke` now supports passing a Method instead of a type signature making this interface somewhat more flexible for certain uncommon use cases ([#56692]). |
| 125 | +* `Timer(f, ...)` will now match the stickiness of the parent task when creating timer tasks, which can be overridden |
| 126 | + by the new `spawn` kwarg. This avoids the issue where sticky tasks i.e. `@async` make their parent sticky ([#56745]) |
| 127 | +* `invoke` now supports passing a CodeInstance instead of a type, which can enable |
| 128 | +certain compiler plugin workflows ([#56660]). |
| 129 | +* `sort` now supports `NTuple`s ([#54494]) |
| 130 | +* `map!(f, A)` now stores the results in `A`, like `map!(f, A, A)`. or `A .= f.(A)` ([#40632]). |
| 131 | +* `Timer` now has readable `timeout` and `interval` properties, and a more descriptive show method ([#57081]) |
| 132 | + |
| 133 | +Standard library changes |
| 134 | +------------------------ |
| 135 | + |
| 136 | +* `gcdx(0, 0)` now returns `(0, 0, 0)` instead of `(0, 1, 0)` ([#40989]). |
| 137 | +* `fd` returns a `RawFD` instead of an `Int` ([#55080]). |
| 138 | + |
| 139 | +#### StyledStrings |
| 140 | + |
| 141 | +#### JuliaSyntaxHighlighting |
| 142 | + |
| 143 | +* A new standard library for applying syntax highlighting to Julia code, this |
| 144 | + uses `JuliaSyntax` and `StyledStrings` to implement a `highlight` function |
| 145 | + that creates an `AnnotatedString` with syntax highlighting applied. ([#51810]) |
| 146 | + |
| 147 | +#### Package Manager |
| 148 | + |
| 149 | +#### LinearAlgebra |
| 150 | + |
| 151 | +* `rank` can now take a `QRPivoted` matrix to allow rank estimation via QR factorization ([#54283]). |
| 152 | +* Added keyword argument `alg` to `eigen`, `eigen!`, `eigvals` and `eigvals!` for self-adjoint |
| 153 | + matrix types (i.e., the type union `RealHermSymComplexHerm`) that allows one to switch |
| 154 | + between different eigendecomposition algorithms ([#49355]). |
| 155 | +* Added a generic version of the (unblocked) pivoted Cholesky decomposition |
| 156 | + (callable via `cholesky[!](A, RowMaximum())`) ([#54619]). |
| 157 | +* The number of default BLAS threads now respects process affinity, instead of |
| 158 | + using total number of logical threads available on the system ([#55574]). |
| 159 | +* A new function `zeroslike` is added that is used to generate the zero elements for matrix-valued banded matrices. |
| 160 | + Custom array types may specialize this function to return an appropriate result ([#55252]). |
| 161 | +* The matrix multiplication `A * B` calls `matprod_dest(A, B, T::Type)` to generate the destination. |
| 162 | + This function is now public ([#55537]). |
| 163 | +* The function `haszero(T::Type)` is used to check if a type `T` has a unique zero element defined as `zero(T)`. |
| 164 | + This is now public ([#56223]). |
| 165 | +* A new function `diagview` is added that returns a view into a specific band of an `AbstractMatrix` ([#56175]). |
| 166 | + |
| 167 | +#### Logging |
| 168 | + |
| 169 | +#### Printf |
| 170 | + |
| 171 | +#### Profile |
| 172 | + |
| 173 | +* `Profile.take_heap_snapshot` takes a new keyword argument, `redact_data::Bool`, |
| 174 | + that is `true` by default. When set, the contents of Julia objects are not emitted |
| 175 | + in the heap snapshot. This currently only applies to strings. ([#55326]) |
| 176 | +* `Profile.print()` now colors Base/Core/Package modules similarly to how they are in stacktraces. |
| 177 | + Also paths, even if truncated, are now clickable in terminals that support URI links |
| 178 | + to take you to the specified `JULIA_EDITOR` for the given file & line number. ([#55335]) |
| 179 | + |
| 180 | +#### Random |
| 181 | + |
| 182 | +#### REPL |
| 183 | + |
| 184 | +- Using the new `usings=true` feature of the `names()` function, REPL completions can now |
| 185 | + complete names that have been explicitly `using`-ed. ([#54610]) |
| 186 | +- REPL completions can now complete input lines like `[import|using] Mod: xxx|` e.g. |
| 187 | + complete `using Base.Experimental: @op` to `using Base.Experimental: @opaque`. ([#54719]) |
| 188 | +- the REPL will now warn if it detects a name is being accessed from a module which does not define it (nor has a submodule which defines it), |
| 189 | + and for which the name is not public in that module. For example, `map` is defined in Base, and executing `LinearAlgebra.map` |
| 190 | + in the REPL will now issue a warning the first time occurs. ([#54872]) |
| 191 | +- When an object is printed automatically (by being returned in the REPL), its display is now truncated after printing 20 KiB. |
| 192 | + This does not affect manual calls to `show`, `print`, and so forth. ([#53959]) |
| 193 | +- Backslash completions now print the respective glyph or emoji next to each matching backslash shortcode. ([#54800]) |
| 194 | + |
| 195 | +#### SuiteSparse |
| 196 | + |
| 197 | +#### SparseArrays |
| 198 | + |
| 199 | +#### Test |
| 200 | + |
| 201 | +* A failing `DefaultTestSet` now 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. |
| 202 | + It is also possible seed a test set by passing the `rng` keyword argument to `@testset`: |
| 203 | + ```julia |
| 204 | + using Test, Random |
| 205 | + @testset rng=Xoshiro(0x2e026445595ed28e, 0x07bb81ac4c54926d, 0x83d7d70843e8bad6, 0xdbef927d150af80b, 0xdbf91ddf2534f850) begin |
| 206 | + @test rand() == 0.559472630416976 |
| 207 | + end |
| 208 | + ``` |
| 209 | + |
| 210 | +#### Dates |
| 211 | + |
| 212 | +#### Statistics |
| 213 | + |
| 214 | +#### Distributed |
| 215 | + |
| 216 | +#### Unicode |
| 217 | + |
| 218 | +#### DelimitedFiles |
| 219 | + |
| 220 | +#### InteractiveUtils |
| 221 | + |
| 222 | +* New macros `@trace_compile` and `@trace_dispatch` for running an expression with |
| 223 | + `--trace-compile=stderr --trace-compile-timing` and `--trace-dispatch=stderr` respectively enabled. |
| 224 | + ([#55915]) |
| 225 | + |
| 226 | +Deprecated or removed |
| 227 | +--------------------- |
| 228 | + |
| 229 | +External dependencies |
| 230 | +--------------------- |
| 231 | + |
| 232 | +- The terminal info database, `terminfo`, is now vendored by default, providing a better |
| 233 | + REPL user experience when `terminfo` is not available on the system. Julia can be built |
| 234 | + without vendoring the database using the Makefile option `WITH_TERMINFO=0`. ([#55411]) |
| 235 | + |
| 236 | +Tooling Improvements |
| 237 | +-------------------- |
| 238 | + |
| 239 | +- 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]). |
| 240 | + |
| 241 | +<!--- generated by NEWS-update.jl: --> |
| 242 | +[#39071]: https://github.com/JuliaLang/julia/issues/39071 |
| 243 | +[#40632]: https://github.com/JuliaLang/julia/issues/40632 |
| 244 | +[#40989]: https://github.com/JuliaLang/julia/issues/40989 |
| 245 | +[#45793]: https://github.com/JuliaLang/julia/issues/45793 |
| 246 | +[#49355]: https://github.com/JuliaLang/julia/issues/49355 |
| 247 | +[#50988]: https://github.com/JuliaLang/julia/issues/50988 |
| 248 | +[#51149]: https://github.com/JuliaLang/julia/issues/51149 |
| 249 | +[#51810]: https://github.com/JuliaLang/julia/issues/51810 |
| 250 | +[#52103]: https://github.com/JuliaLang/julia/issues/52103 |
| 251 | +[#52999]: https://github.com/JuliaLang/julia/issues/52999 |
| 252 | +[#53159]: https://github.com/JuliaLang/julia/issues/53159 |
| 253 | +[#53341]: https://github.com/JuliaLang/julia/issues/53341 |
| 254 | +[#53415]: https://github.com/JuliaLang/julia/issues/53415 |
| 255 | +[#53474]: https://github.com/JuliaLang/julia/issues/53474 |
| 256 | +[#53515]: https://github.com/JuliaLang/julia/issues/53515 |
| 257 | +[#53664]: https://github.com/JuliaLang/julia/issues/53664 |
| 258 | +[#53687]: https://github.com/JuliaLang/julia/issues/53687 |
| 259 | +[#53742]: https://github.com/JuliaLang/julia/issues/53742 |
| 260 | +[#53959]: https://github.com/JuliaLang/julia/issues/53959 |
| 261 | +[#54107]: https://github.com/JuliaLang/julia/issues/54107 |
| 262 | +[#54283]: https://github.com/JuliaLang/julia/issues/54283 |
| 263 | +[#54494]: https://github.com/JuliaLang/julia/issues/54494 |
| 264 | +[#54504]: https://github.com/JuliaLang/julia/issues/54504 |
| 265 | +[#54595]: https://github.com/JuliaLang/julia/issues/54595 |
| 266 | +[#54609]: https://github.com/JuliaLang/julia/issues/54609 |
| 267 | +[#54610]: https://github.com/JuliaLang/julia/issues/54610 |
| 268 | +[#54619]: https://github.com/JuliaLang/julia/issues/54619 |
| 269 | +[#54653]: https://github.com/JuliaLang/julia/issues/54653 |
| 270 | +[#54662]: https://github.com/JuliaLang/julia/issues/54662 |
| 271 | +[#54707]: https://github.com/JuliaLang/julia/issues/54707 |
| 272 | +[#54719]: https://github.com/JuliaLang/julia/issues/54719 |
| 273 | +[#54800]: https://github.com/JuliaLang/julia/issues/54800 |
| 274 | +[#54834]: https://github.com/JuliaLang/julia/issues/54834 |
| 275 | +[#54872]: https://github.com/JuliaLang/julia/issues/54872 |
| 276 | +[#55047]: https://github.com/JuliaLang/julia/issues/55047 |
| 277 | +[#55080]: https://github.com/JuliaLang/julia/issues/55080 |
| 278 | +[#55099]: https://github.com/JuliaLang/julia/issues/55099 |
| 279 | +[#55252]: https://github.com/JuliaLang/julia/issues/55252 |
| 280 | +[#55326]: https://github.com/JuliaLang/julia/issues/55326 |
| 281 | +[#55335]: https://github.com/JuliaLang/julia/issues/55335 |
| 282 | +[#55351]: https://github.com/JuliaLang/julia/issues/55351 |
| 283 | +[#55411]: https://github.com/JuliaLang/julia/issues/55411 |
| 284 | +[#55537]: https://github.com/JuliaLang/julia/issues/55537 |
| 285 | +[#55574]: https://github.com/JuliaLang/julia/issues/55574 |
| 286 | +[#55763]: https://github.com/JuliaLang/julia/issues/55763 |
| 287 | +[#55772]: https://github.com/JuliaLang/julia/issues/55772 |
| 288 | +[#55793]: https://github.com/JuliaLang/julia/issues/55793 |
| 289 | +[#55848]: https://github.com/JuliaLang/julia/issues/55848 |
| 290 | +[#55889]: https://github.com/JuliaLang/julia/issues/55889 |
| 291 | +[#55915]: https://github.com/JuliaLang/julia/issues/55915 |
| 292 | +[#56175]: https://github.com/JuliaLang/julia/issues/56175 |
| 293 | +[#56196]: https://github.com/JuliaLang/julia/issues/56196 |
| 294 | +[#56223]: https://github.com/JuliaLang/julia/issues/56223 |
| 295 | +[#56320]: https://github.com/JuliaLang/julia/issues/56320 |
| 296 | +[#56346]: https://github.com/JuliaLang/julia/issues/56346 |
| 297 | +[#56660]: https://github.com/JuliaLang/julia/issues/56660 |
| 298 | +[#56692]: https://github.com/JuliaLang/julia/issues/56692 |
| 299 | +[#56745]: https://github.com/JuliaLang/julia/issues/56745 |
| 300 | +[#56925]: https://github.com/JuliaLang/julia/issues/56925 |
| 301 | +[#57069]: https://github.com/JuliaLang/julia/issues/57069 |
| 302 | +[#57081]: https://github.com/JuliaLang/julia/issues/57081 |
| 303 | +[#57087]: https://github.com/JuliaLang/julia/issues/57087 |
| 304 | +[#57109]: https://github.com/JuliaLang/julia/issues/57109 |
| 305 | + |
1 | 306 | Julia v1.11 Release Notes
|
2 | 307 | ========================
|
3 | 308 |
|
|
0 commit comments