{ "newestReleaseInSnapshot": "1.1.0", "nightlyBeyondPin": { "entries": [], "provenance": { "commit": "c6fa49f712fe15c99d0461ad2baaf2a15cbc58ce", "license": "Apache-2.0 WITH LLVM-exception (per file headers; confirm the docs carry the same licence)", "path": "docs/site/nightly-changelog.md", "repo": "modular/modular", "source": "modular", "zipSha256": "5220972c0e4d2a447170592f329361b3e9923f3a30162135d22717913a09b2d6" } }, "notes": { "provenance": { "commit": "c6fa49f712fe15c99d0461ad2baaf2a15cbc58ce", "license": "Apache-2.0 WITH LLVM-exception (per file headers; confirm the docs carry the same licence)", "path": "docs/site/releases/v1.1.0.md", "repo": "modular/modular", "source": "modular", "zipSha256": "5220972c0e4d2a447170592f329361b3e9923f3a30162135d22717913a09b2d6" }, "sections": [ { "anchor": "1-1-0-highlights", "bullets": [ "**Contextually inferred member references**: a leading-dot form such as `.red` or `.float64` now resolves against the expected type of the expression, so you can omit a redundant type name wherever context already supplies it.", "**Performance improvements**: compile times and generated code both improve.", "**Continued migration to unified closures**: the move from legacy closures (passed as compile-time parameters) to unified closures (passed as runtime arguments) carries on.", "**Continuing library stabilizations**: the deliberately small set of stable standard library APIs introduced in 1.0 grows again, adding signatures on `String`, `SIMD`, and `List`.", "**Continuing cleanup**: the deprecation cleanup begun in the 1.0 cycle completes." ], "level": 2, "title": "Highlights" }, { "anchor": "1-1-0-documentation", "bullets": [ "Revised the quickstart: the install matrix is now a plain project-setup checklist, every section ends in a \"Checkpoint\" callout, and it now covers functions and error handling (`try`/`except`/`else`/`finally`).", "Expanded the get-started tutorial with a 45-60 minute time estimate up front, guidance for readers coming from another language on using the Checkpoints to map unfamiliar syntax, clearer sample code, and concrete next steps." ], "level": 2, "title": "Documentation" }, { "anchor": "1-1-0-language-enhancements", "bullets": [ "Mojo now supports contextually inferred member references: a leading-dot form such as `.red` or `.float64` resolves against the expected type of the expression, so you can omit a redundant type name when context already supplies it.", "The new `@inline(value)` decorator selects a function's inline level.", "Two inline decorators that disagree are now an error rather than one silently winning.", "Unknown declaration errors now suggest a unique near-miss spelling from the enclosing scopes (for example `coun` → `count`), with a replace-token fixit.", "A `thin` function type can now carry trailing [`where` clauses](/docs/manual/metaprogramming/constraints/), constraining the parameters it declares.", "Code that performs many implicit conversions, most visibly large collection literals, compiles faster: the compiler no longer runs parameter inference on constructors that cannot be used for an implicit conversion in the first place." ], "level": 2, "title": "Language enhancements" }, { "anchor": "1-1-0-language-changes", "bullets": [ "Implicit variable declaration now produces an error instead of a warning.", "A walrus expression now always yields its right-hand side, uniformly for every kind of target.", "Use of the `read` argument convention is now a hard error, following a period of deprecation; use `imm` instead.", "Binding a constrained function to a function type that declares no matching `where` clause is now an error, instead of silently dropping the constraint.", "Renamed the [`@parameter`](/docs/reference/decorators/parameter/) decorator on parametric closures to `@__parameter`, which is now used only for declaring legacy closures.", "The module and package system:" ], "level": 2, "title": "Language changes" }, { "anchor": "1-1-0-library-stabilizations", "bullets": [ "[`String`](/docs/std/collections/string/string/String/) - `def __init__(out self):` - `def __init__(out self, *, capacity_bytes: Int):` - `def reserve_bytes(mut self, new_capacity_bytes: Int, /):`", "[`SIMD`](/docs/std/simd/SIMD/) - `def __init__(out self):` - `def __eq__(self, rhs: Self) -> Bool:` - `def __len__(self) -> Int:`", "[`List`](/docs/std/collections/list/List/) - `def append(mut self, var value: Self.T, /):`" ], "level": 2, "title": "Library stabilizations" }, { "anchor": "1-1-0-library-performance-improvements", "bullets": [ "[`List.extend()`](/docs/std/collections/list/List/#extend) and [`List.resize()`](/docs/std/collections/list/List/#resize) now grow geometrically, so repeatedly extending or resizing by a small increment is no longer quadratic.", "Files with many t-string literals (`t\"...\"`) compile faster: the compile-time step that encodes each literal's format string (part of elaboration, not the whole compile) is about 7x faster.", "[`TString`](/docs/std/format/tstring/TString/) no longer carries its format string as a parameter, so distinct t-string literals share one specialization instead of emitting a function each, and the message-formatting paths of [`debug_assert()`](/docs/std/builtin/debug_assert/debug_assert/) and [`ab" ], "level": 2, "title": "Library performance improvements" }, { "anchor": "1-1-0-library-changes", "bullets": [], "level": 2, "title": "Library changes" }, { "anchor": "1-1-0-unified-closures", "bullets": [ "Migrated the following APIs to unified closures: [`sort()`](/docs/std/builtin/sort/sort/), `debug_assert()`, and [`Span.apply()`](/docs/std/collections/span/Span/#apply).", "[`std.algorithm`](/docs/std/algorithm/)'s `tile()`, `unswitch()`, `tile_and_unswitch()`, and `tile_middle_unswitch_boundaries()` now take their workgroup function as a trailing closure argument instead of a legacy closure parameter, as in `tile[sizes](offset, bound, workgroup_function=body)`.", "The benchmarking APIs now take unified closures instead of legacy closures, and the parameter forms are gone:" ], "level": 3, "title": "Unified closures" }, { "anchor": "1-1-0-collections", "bullets": [ "[`Array`](/docs/std/collections/array/Array/) now conforms to [`Comparable`](/docs/std/builtin/comparable/Comparable/) when its element type does, adding `<`, `<=`, `>`, and `>=`.", "`Array` now conforms to [`Defaultable`](/docs/std/builtin/value/Defaultable/) when its type `T` is also `Defaultable`.", "`Array` now supports concatenation with the `concat()` method when its type `T` is [`Movable`](/docs/std/traits/movable/Movable/).", "`Array` now supports repetition with the `repeat()` method when its type `T` is [`Copyable`](/docs/std/traits/copyable/Copyable/).", "`Array[T, N]` has a new `fill_with=` constructor that calls a function with each index in `[0, N)` and writes its result into that position, replacing the `Array(uninitialized=True)` plus manual fill-loop idiom.", "`List`'s element type is now bounded by [`AnyType`](/docs/std/traits/anytype/AnyType/) instead of `Movable`.", "`List` has a new `fill_with=` constructor that calls a function with each index in `[0, length)` and writes its result into that position, without requiring the element type to be `Movable`.", "[`StringDict`](/docs/std/collections/dict/StringDict/) now conforms to [`Writable`](/docs/std/format/Writable/) when its value type is `Writable`, matching the existing behavior of [`Dict`](/docs/std/collections/dict/Dict/).", "`StringDict.__getitem__()` now accepts a [`StringSpan`](/docs/std/collections/string/string_span/StringSpan/), so you can index a `StringDict` with a borrowed string view without first allocating a `String` just to perform the lookup.", "You can now construct a [`Counter`](/docs/std/collections/counter/Counter/) from any iterable of values, not just a `List`, for example `Counter([\"a\", \"a\", \"b\"])` or `Counter(String(\"aaab\").bytes())`." ], "level": 3, "title": "Collections" }, { "anchor": "1-1-0-pointer-memory", "bullets": [ "Deprecated `is_trivially_movable()`, `is_trivially_copyable()`, and `is_trivially_deletable()` in [`std.memory`](/docs/std/memory/) in favor of `IsTriviallyMovable[T]`, `IsTriviallyCopyable[T]`, and `IsTriviallyDeinitable[T]` in [`std.traits`](/docs/std/traits/).", "Renamed `UnsafeMaybeUninit` to [`MaybeUninit`](/docs/std/memory/maybe_uninit/MaybeUninit/).", "Added a [`deinit()`](/docs/std/traits/deinitable/deinit/) free function for any `Deinitable` type, to explicitly extend a value's lifetime up to a specific point and run its deinitializer there.", "Added `Pointer[T].unsafe_write(def() -> T)`, which initializes the pointee with the value returned by a closure, constructing it directly in place rather than moving an already-constructed value there.", "Added `write()` to `MaybeUninit` and [`Pointer`](/docs/std/memory/pointer/Pointer/), as a safe counterpart to `unsafe_write()` for types that are trivially deinitializable (for example `Int`).", "Deprecated `Pointer.mut_cast()`.", "Renamed `CStringSlice` to [`CStringSpan`](/docs/std/ffi/cstring/CStringSpan/), matching the `Span`-based naming of the other non-owning view types (`StringSpan`, [`Span`](/docs/std/collections/span/Span/)).", "Added `ptr()` to [`StringLiteral`](/docs/std/builtin/string_literal/StringLiteral/), `CStringSpan`, [`ArcPointer`](/docs/std/memory/arc_pointer/ArcPointer/), and [`OwnedPointer`](/docs/std/memory/owned_pointer/OwnedPointer/), deprecating their `unsafe_ptr()` methods." ], "level": 3, "title": "Pointer and memory" }, { "anchor": "1-1-0-type-system", "bullets": [ "[`OwnedDLHandle`](/docs/std/ffi/OwnedDLHandle/) now conforms to [`Boolable`](/docs/std/builtin/bool/Boolable/).", "[`Hasher.update()`](/docs/std/hashlib/hasher/Hasher/#update) now takes an `ImmSpan[Byte, _]` instead of `Some[Hashable]`.", "Renamed the variadic type-list parameter on [`Tuple`](/docs/std/builtin/tuple/Tuple/) and [`VariadicPack`](/docs/std/builtin/variadics/VariadicPack/) to `Ts`, standardizing the naming convention used across the standard library.", "[`Atomic`](/docs/std/atomic/atomic/Atomic/) is now parameterized on a value type `T` instead of a [`DType`](/docs/std/builtin/dtype/DType/).", "Renamed `any_satisfies()` and `all_satisfies()` on [`TypeList`](/docs/std/builtin/variadics/TypeList/) and [`ParameterList`](/docs/std/builtin/variadics/ParameterList/) to `any()` and `all()`." ], "level": 3, "title": "Traits and type system" }, { "anchor": "1-1-0-targets", "bullets": [ "[`CompilationTarget`](/docs/std/sys/info/CompilationTarget/) has a new `is_arm()` predicate, and `is_x86()` now reports the architecture rather than SSE4 availability.", "`CompilationTarget` can now describe RISC-V targets: `is_riscv()`, `is_rv32()`, and `is_rv64()` report the architecture, and `has_riscv_extension[\"m\"]()` reports a single ISA extension by its lowercase LLVM name." ], "level": 3, "title": "Compilation targets" }, { "anchor": "1-1-0-python", "bullets": [ "Python functions exposed through [`PythonModuleBuilder.def_function()`](/docs/std/python/bindings/PythonModuleBuilder/#def_function), `PythonTypeBuilder.def_method()`, and `PythonTypeBuilder.def_staticmethod()` no longer have a library-imposed limit on positional arguments.", "[`std.python.numpy`](/docs/std/python/numpy/) now handles multi-dimensional NumPy arrays, not just 1-D:" ], "level": 3, "title": "Python interoperability" }, { "anchor": "1-1-0-other-library", "bullets": [ "The `simd` module moved from [`std.builtin`](/docs/std/builtin/) to the top level of `std`, so `SIMD` and its aliases now live in [`std.simd`](/docs/std/simd/).", "`Coord` has a new `replace[at](value)` method that returns a `Coord` with the element at `at` swapped for `value`, keeping the other elements' types.", "The `chars` argument of `strip()`, `lstrip()`, and `rstrip()` on `StringSpan`, `String`, and `StringLiteral` is now an `ImmStringSpan`, so `chars` now accepts a mutable string, including the string being stripped (`s.strip(s)`).", "Added experimental `DType.float6_e2m3fn` and `DType.float6_e3m2fn`, the two 6-bit encodings from the [Open Compute microscaling specification](https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf).", "Uncaught exceptions now print to `stderr`, not `stdout`.", "You can now construct a `Coord` from an `Array[Scalar[dtype], rank]`, mirroring the existing `IndexList` constructor." ], "level": 3, "title": "Other library changes" }, { "anchor": "1-1-0-gpu-programming", "bullets": [ "The [`max.gpu`](https://max.modular.com/api/mojo/max/gpu/) package now mirrors everything reachable from `std.gpu`, making it a complete entry point for accelerator programming, and the `std.gpu` package is now private, as `std._gpu`." ], "level": 2, "title": "GPU programming" }, { "anchor": "1-1-0-tooling-changes", "bullets": [ "`mojo doc` now reports the condition of a conditional trait conformance, and the generated API docs show it alongside the trait.", "The new `@__doc_inline` decorator on an import statement documents the imported symbols in the importing module, so a package can document an API it re-exports from private modules.", "`mojo build` and `mojo run` can now report where a compile spends its time.", "`--timing-json` emits both timing reports as JSON, and `--timing-file` writes them to a file." ], "level": 2, "title": "Tooling changes" }, { "anchor": "1-1-0-removed", "bullets": [ "Removed the legacy constructs replaced in 1.0, including the `fn`, `alias`, and `__comptime_assert` keywords and the `@parameter if` and `@parameter for` syntax." ], "level": 2, "title": "Removed" }, { "anchor": "1-1-0-removed-aliases", "bullets": [ "Removed the temporary `InlineArray` alias for `Array`, including its re-exports from `std.collections` and the prelude.", "Removed the origin aliases left over from the `Immut` to `Imm` and `External` to `Untracked` renames.", "Removed the pre-unification pointer aliases `MutUnsafePointer`, `ImmUnsafePointer`, `ImmutUnsafePointer`, `ImmutOpaquePointer`, `ImmutPointer`, and `OptionalUnsafePointer`.", "Removed the `size` aliases left from the `size` to `length` rename: `SIMD.size`, `Array.size`, `TypeList.size`, and the `SIMDSize` alias for `SIMDLength`.", "Removed the `as_immutable()` and `get_immutable()` methods on `Pointer`, `Span`, and `StringSpan`.", "Removed the `ImmutSpan` alias.", "Removed `String.as_string_slice()`.", "Removed the `ImplicitlyDestructible` and `ImplicitlyDeletable` aliases.", "Removed the deprecated ownership-transfer methods: `List.steal_data()` and `OwnedPointer.steal_data()` are now `unsafe_take_allocation()`, `OwnedPointer.take()` is `into_inner()`, and `Variant.take()` and `Variant.unsafe_take()` are `unwrap()` and `unsafe_unwrap()`." ], "level": 3, "title": "Deprecated aliases and renamed APIs" }, { "anchor": "1-1-0-removed-int-overloads", "bullets": [ "Removed redundant `Int` overloads across the standard library. [`Int`](/docs/std/simd/#int) is an alias for `Scalar[DType.int]`, so the generic `SIMD` overloads already accept `Int` arguments and return `Int`; call sites need no changes." ], "level": 3, "title": "Redundant `Int` overloads" }, { "anchor": "1-1-0-removed-unsafe-prefix", "bullets": [ "Removed the APIs superseded by their `unsafe_`-prefixed spellings:" ], "level": 3, "title": "Unsafe-prefixed replacements" }, { "anchor": "1-1-0-removed-async", "bullets": [ "Removed `AnyCoroutine`, `Coroutine`, and `RaisingCoroutine` from the prelude, and made the module that defines them private.", "Removed the async task API from the public `std.runtime.asyncrt` module, which is now private." ], "level": 3, "title": "Async APIs" }, { "anchor": "1-1-0-other-removals", "bullets": [ "Removed `String.set_byte_length()`, an internal helper that set the length field without reserving capacity.", "Removed the `validate` parameter from [`b64decode()`](/docs/std/base64/base64/b64decode/), which now always validates.", "Removed the `ConditionalType` type function and the `std.utils.type_functions` module.", "Removed `trait_downcast()`.", "Removed the parametric `benchmark.run[func]()` overloads.", "Removed support for `.mojopkg` files after a period of deprecation." ], "level": 3, "title": "Other removals" }, { "anchor": "1-1-0-fixed", "bullets": [], "level": 2, "title": "Fixed" }, { "anchor": "1-1-0-fixed-compiler", "bullets": [ "The compiler can now prove a `where` clause naming a type that an enclosing `where` clause constrained to a tighter trait.", "Parametric `raises` now accepts any primary expression as the thrown type in a function signature, matching the syntax positions where types otherwise appear.", "A spurious `attempt to resolve a recursive reference to declaration` error no longer fires on valid code.", "The compiler no longer treats an implicit conversion whose constructor candidate it can neither prove nor disprove in the asking scope as a definitive rejection, so a conversion that depends on a parametric constraint alias now resolves once the constraint is known.", "Origin inference now works through an implicit constructor that binds its operand by `ref`.", "`to_layout_tensor()` no longer hangs the compiler on a tensor with a nested layout.", "The compiler no longer crashes while printing a parameter list that contains a positional variadic bound to a single type, so calls such as `helper(Bag[Leaf, tail=1]())` now report a proper conversion error.", "Recursive or excessively deep comptime call graphs no longer crash the compiler.", "Forwarding a `VariadicPack` that came from somewhere other than a call site, such as one returned from a function declared `-> VariadicPack[..]`, no longer crashes the compiler.", "A comptime call that names its callee concretely no longer aborts in the compile-time interpreter.", "The compiler no longer folds a loop result that was only constant on some paths to that constant." ], "level": 3, "title": "Compiler and comptime" }, { "anchor": "1-1-0-fixed-simd-numeric", "bullets": [ "[#6850](https://github.com/modular/modular/issues/6850) - `SIMD.__init__(py=...)` now reads unsigned dtypes through the unsigned CPython entry point (`PyLong_AsSize_t`).", "[#6921](https://github.com/modular/modular/issues/6921) - A union whose widest member is a `SIMD[DType.bool, N]` with `N > 1`, such as `Optional[SIMD[DType.bool, 2]]`, now compiles.", "[#6851](https://github.com/modular/modular/issues/6851) - [`hash()`](/docs/std/hashlib/hash/hash/) on a floating-point `SIMD` value now normalizes the sign of zero, so `hash(-0.0) == hash(0.0)`.", "Fixed [`ceildiv()`](/docs/std/math/math/ceildiv/) returning `0` for unsigned operands near the type's maximum value.", "`sqrt()`, `rsqrt()`, `pow()`, `sin()`, `cos()`, `log10()`, and `log1p()` now work on Apple GPUs." ], "level": 3, "title": "Numerics and SIMD" }, { "anchor": "1-1-0-fixed-pointer-memory", "bullets": [ "Destroying an [`OwnedDLHandle`](/docs/std/ffi/OwnedDLHandle/) that holds a null handle no longer crashes the process.", "`unsafe_uninit_move_n()` and `unsafe_uninit_copy_n()` with `overlapping=True` now handle an overlap in either direction when `T` is not trivially movable or copyable.", "Every value of a struct type whose [`@align(N)`](/docs/reference/decorators/align/) exceeds its natural alignment is now aligned to `N`, including every element of an array or a `List` of that type.", "`unsafe_memcpy()` now chunks GPU copies by register width." ], "level": 3, "title": "Memory and pointers" }, { "anchor": "1-1-0-fixed-tooling", "bullets": [ "`mojo build` can cross-compile to RISC-V again.", "`mojo build --print-supported-targets` no longer lists targets that the compiler cannot generate code for.", "`mojo build --emit asm` and `--emit llvm` now always write the offload kernel files next to the host output file.", "Importing a precompiled package now resolves that package's own recorded dependencies from the importing file's location, so the compiler again finds a dependency that lives beside the main file." ], "level": 3, "title": "Tooling and build" }, { "anchor": "1-1-0-fixed-ranges", "bullets": [ "An integer [`range()`](/docs/std/builtin/range/range/) with a step of zero is now always empty.", "A strided `range()` no longer iterates forever when the element after the last one falls outside the element type, as in `range(UInt8(250), UInt8(255), UInt8(2))`.", "[`reversed()`](/docs/std/builtin/reversed/reversed/) on a scalar `range()` no longer yields an empty iterator when the range starts within one step of the element type's limit, as in `reversed(range(Int8.MIN, Int8.MIN + 8, Int8(1)))`." ], "level": 3, "title": "Ranges and iteration" }, { "anchor": "1-1-0-fixed-string", "bullets": [ "[#6831](https://github.com/modular/modular/issues/6831) - `base64.b64decode()` now raises an error when the input length is not divisible by 4 instead of reading past the end of the input (or aborting when asserts are enabled).", "[#3446](https://github.com/modular/modular/issues/3446) - [`b64decode()`](/docs/std/base64/base64/b64decode/) now ignores ASCII whitespace in its input, so base64 text wrapped across lines by a MIME encoder or the `base64` command-line tool decodes without the caller stripping it first.", "[#6834](https://github.com/modular/modular/issues/6834) - [`atol()`](/docs/std/collections/string/string/atol/) (and therefore `Int(String)`) now raises for every value outside the `Int` range." ], "level": 3, "title": "Strings and encoding" }, { "anchor": "1-1-0-fixed-system", "bullets": [ "[`os.path.join()`](/docs/std/os/path/path/join/) now inserts separators based on the accumulated path rather than the first argument, so `join(\"/\", \"a\", \"b\")` returns `/a/b` (previously `/ab`) and `join(\"a\", \"b/\", \"c\")` returns `a/b/c` (previously `a/b//c`).", "[#6838](https://github.com/modular/modular/issues/6838) - On macOS, [`os.stat()`](/docs/std/os/fstat/stat/) and [`os.lstat()`](/docs/std/os/fstat/lstat/) no longer return a negative `st_mode` for regular files.", "[#6839](https://github.com/modular/modular/issues/6839) - On macOS, `os.stat()` and `os.lstat()` now report file timestamps with the correct nanosecond values." ], "level": 3, "title": "OS and system" }, { "anchor": "1-1-0-other-fixes", "bullets": [ "[`Counter.most_common(n)`](/docs/std/collections/counter/Counter/#most_common) now returns all elements when `n` exceeds the number of unique elements, matching Python, instead of aborting.", "[#6833](https://github.com/modular/modular/issues/6833) - [`PythonObject`](/docs/std/python/python_object/PythonObject/) no longer leaks a CPython reference per positional argument when calling a Python object, nor when setting an item, attribute, or set literal element." ], "level": 3, "title": "Other fixes" }, { "anchor": "1-1-0-special-thanks", "bullets": [], "level": 3, "title": "Special thanks" } ] }, "pin": "1.1.0", "snapshot": "same" }