Mojo v1.0.0b2 | Mojo
IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md).<br>For the complete Mojo documentation index, see llms.txt.<br>Skip to main content<br>Highlights
Collections no longer require Copyable elements. The core collection<br>types — List, Deque, LinkedList, InlineArray, Dict, and Set — now<br>accept move-only elements, with Movable & ImplicitlyDestructible as the new<br>minimum bound instead of Copyable. This removes a longstanding source of<br>friction where storing a value in a collection forced it, and its contents, to<br>become copyable. Copy-requiring methods stay gated on Copyable. See<br>Collections and iterators.
Trailing where clauses in more places. Trailing where clauses are now<br>supported on struct declarations, on comptime alias declarations, and to<br>discharge constraints from constrained types used anywhere in a signature. A<br>single trailing where can simultaneously constrain a declaration and satisfy<br>the requirements of the types it uses, and the compiler suggests the missing<br>clause when one is needed. See<br>Language enhancements.
enqueue_function() and compile_function() take a single kernel<br>argument. DeviceContext.enqueue_function[func]() and<br>compile_function[func]() now accept the kernel parameter once instead of<br>requiring it twice, cleaning up every GPU function callsite. The old<br>two-argument forms and the transitional *_experimental aliases are<br>deprecated. See Device context and execution.
Unicode-aware string subscripting. String and StringSlice now support<br>keyword subscripts that index or slice by Unicode codepoint<br>([codepoint=...]) or by grapheme cluster ([grapheme=...]), so<br>String("🔄🔥🔄")[codepoint=1:2] returns "🔥". This makes correct,<br>encoding-aware text indexing straightforward without manual byte arithmetic.<br>See String and text.
Faster Python → Mojo interop. Calls into Mojo from Python now carry<br>significantly less per-call overhead: non-kwargs callables use CPython's<br>METH_FASTCALL convention, PythonObject.__del__() skips the GIL round-trip<br>when the calling thread already holds the GIL, and integer conversions<br>fast-path exact Python int values. No code changes are required to benefit.<br>See Python interoperability.
New and expanded documentation. This release adds a Closures page, new<br>TileTensor guides, expanded coverage of partially bound and unbound types<br>and rebind(), and several new reference pages — built-in types, function<br>overloads, closure declarations, CLI feature toggles, and docstrings — plus a<br>downloadable Mojo basics cheat sheet. See<br>Documentation.
mojo package is now mojo precompile. The packaging command has been<br>renamed and the .mojopkg extension deprecated in favor of .mojoc —<br>affecting everyone who precompiles Mojo packages, notably custom-op authors.<br>The new .mojoc packages are also significantly smaller, with faster compile<br>and load times. See Tooling changes.
Inspect and clear the Mojo compile cache. New<br>mojo --print-cache-location and mojo --clear-cache flags report and purge<br>the on-disk compile cache (.mojo_cache), honoring the standard cache-path<br>precedence. --clear-cache prompts by default; pass -f to skip it for<br>scripting. See Tooling changes.
fn is now an error. Uses of the legacy fn keyword now produce a<br>compilation error rather than a warning, completing the def/fn unification:<br>def is Mojo's single function-declaration keyword. Move any remaining fn<br>declarations to def. See Removed.
Implicit std imports are now an error. Standard library imports must be<br>fully qualified; the compiler no longer implicitly resolves bare std module<br>names. Besides making imports explicit, this stops the compiler from squatting<br>on names like algorithm and memory, freeing them for user modules. See<br>Language changes.
Reflection API restructuring. reflect[T] is now a comptime alias for<br>the Reflected[T] handle type rather than a function, so call sites drop<br>their parentheses (reflect[T].name()), and the deprecated free-function<br>reflection API (get_type_name(), the struct_field_* family, and<br>ReflectedType[T]) has been removed in favor of methods on reflect[T]. A<br>new reflect_fn[func] alias adds parallel function-side reflection. See<br>Reflection.
Documentation
Added a Closures page to the Mojo Manual<br>documenting the unified capture-list syntax, with runnable examples for each<br>capture convention.
Added new Mojo Manual documentation for TileTensor, including an updated<br>tile Layout guide, a<br>TileTensor guide with examples, and an<br>introduction describing the relationship between<br>TileTensor and LayoutTensor.
Expanded the Mojo Manual coverage of<br>partially bound and unbound types<br>and<br>automatic parameterization,<br>with clearer and more discoverable guidance on rebind().
Added several new Mojo reference pages:<br>built-in (prelude) types available without imports,<br>function overloads and the compiler's overload-resolution rules,<br>closure declarations,<br>CLI feature toggles, and<br>Mojo docstrings. Also added a<br>Mojo basics cheat sheet, a...