Skip to main content
Version: Nightly

v0.6.1 (2023-12-18)

⭐️ New

  • The Mojo REPL now provides limited support for the %cd magic command.

    This command automatically maintains an internal stack of directories you visit during the REPL session. Usage:

    • %cd 'dir': change to directory dir and push it on the directory stack.
    • %cd -: pop the directory stack and change to the last visited directory.
  • Structs decorated with @value now automatically conform to the Movable and Copyable built-in traits.

  • String now has new toupper() and tolower() methods analogous, respectively, to Python's str.toupper() and str.tolower().

  • Added a hash() built-in function and Hashable trait for types implementing the __hash__() method. Future releases will add Hashable support to Standard Library types. In the meantime, the hash module includes a version of the hash() function that works on arbitrary byte strings. To generate hashes for SIMD types, you use the internal _hash_simd() function:

    from builtin.hash import _hash_simd

    fn gen_simd_hash():
    let vector = SIMD[DType.int64, 4](1, 2, 3, 4)
    let hash = _hash_simd(vector)
  • Several standard library types now conform to the CollectionElement trait. These types include Bool, StringLiteral, DynamicVector, Tensor, TensorShape, and TensorSpec.

🦋 Changed

  • utils.vector has been moved to a new collections package to make space for new collections. This means that if you had previous code that did from utils.vector import DynamicVector, it now needs to be from collections.vector import DynamicVector due to the move.

  • The special destructor method __del__() has been changed to enforce that it cannot raise an error. Raising destructors are not supported properly at the moment.

🛠️ Fixed

  • #1421 - Fixed a crash when using Tuples in the REPL.

  • #222 - Generate an error for obviously self recursive functions.

  • #1408 - Fix overload resolution when candidates can return generic types.

  • #1413 and #1395 - Do not crash when re-declaring a builtin declaration.

  • #1307 - Fix compatibility of function signatures that only differ in default argument values.

  • #1380 - Fix printing of empty String.