Jump to content

Mojo (programming language)

From Wikipedia, the free encyclopedia

Mojo
Paradigms
FamilyPython
Designed byChris Lattner[1]
DeveloperModular Inc.
First appeared2023; 3 years ago (2023)
Stable release
1.0.0[2] / August 11, 2026; 12 days ago (2026-08-11)
Typing discipline
OSCross-platform: Linux, macOS
LicenseMojo language: Apache License 2.0 with LLVM exceptions;[3][4][5] Mojo standard library: Apache License 2.0 with LLVM exceptions[6]
Filename extensions.🔥 (the fire emoji/U+1F525 Unicode character), alternatively .mojo
Websitemojolang.org
Influenced by
Python, Cython, C, C++, Rust, Swift, Zig, CUDA, MLIR[7][8][9]

Mojo is an open source[3][5] programming language for Linux and macOS.[10][11] It is a systems programming language with semantics inspired by Rust such as static typing and a borrow checker,[12][13] but (like Nim or Julia) uses a syntax designed to be reminiscent of Python.[14][15][16] It was originally intended to be a superset of Python, but this goal was either abandoned or postponed indefinitely by March 2026.[17] In May 2026, Modular launched a website for the language[18] and in August 2026, Modular released Mojo 1.0;[19] in the same month, Modular open-sourced Mojo.[3][5]

Mojo builds on the Multi-Level Intermediate Representation (MLIR) compiler software framework, instead of directly on the lower level LLVM compiler framework used by languages like Julia, Swift, C++, and Rust.[16][20] MLIR is a newer compiler framework that allows Mojo to exploit higher level compiler passes unavailable in LLVM alone, and allows Mojo to compile down and target more than only central processing units (CPUs), including producing code that can run on graphics processing units (GPUs), Tensor Processing Units (TPUs), application-specific integrated circuits (ASICs) and other accelerators. It can also often more effectively use certain types of CPU optimizations directly, like single instruction, multiple data (SIMD) with minor intervention by a developer, as occurs in many other languages.[21][22] According to Jeremy Howard of fast.ai, Mojo can be seen as "syntax sugar for MLIR" and for that reason Mojo is well optimized for applications like artificial intelligence (AI).[8]

Origin and development history

[edit source]

The Mojo programming language was created by Modular Inc, which was founded by Chris Lattner, the original architect of the Swift programming language and LLVM, and Tim Davis, a former Google employee.[23] The intention behind Mojo is to bridge the gap between Python’s ease of use and the fast performance required for cutting-edge AI applications.[24]

According to public change logs, Mojo development goes back to 2022.[25] In May 2023, the first publicly testable version was made available online via a hosted playground.[26] By September 2023 Mojo was available for local download for Linux[27] and by October 2023 it was also made available for download on Apple's macOS.[28] The SDK included a command-line driver, a Visual Studio Code extension, and a Jupyter kernel.[11]

In March 2024, Modular open sourced the Mojo standard library and started accepting community contributions under the Apache 2.0 license.[29][30]

In December 2025, Modular published a roadmap toward a 1.0 release, stating that Mojo 1.0 would stabilize core language features and that additional features, such as a match statement and enums, would follow in 1.x releases.[31] On 7 May 2026, Modular released Mojo 1.0.0 beta 1 and launched the language's website, mojolang.org.[18][32] On 11 August 2026, Modular released Mojo 1.0.0,[19][33] and one week later on 18 August 2026, Modular open-sourced the Mojo compiler under the Apache 2.0 license.[3][5]

Features

[edit source]

Mojo was created for an easy transition from Python. The language has syntax similar to Python's, with inferred static typing,[34] and allows users to import Python modules.[35][36] It uses LLVM and MLIR as its compilation backend.[16][37][38] Mojo programs can import and call Python modules via the CPython runtime, and Mojo functions can be called from Python through C-compatible bindings.[18] The language is not source-compatible with Python 3. It does not support Python's class system; instead it provides struct types, memory-optimized alternatives to classes that support methods, fields, operator overloading, and decorators.[39][18] Python-style list, set, and dictionary comprehensions are supported.[40]

The language also provides a borrow checker, an influence from Rust.[41] Function arguments are passed as immutable references by default (the read convention). Functions may instead declare arguments as mutable references (mut) or take ownership of them, and ownership can be transferred with the ^ operator.[18][42]

Both the Mojo language compiler and the Mojo standard library are open source under the Apache 2.0 license with LLVM Exceptions.[3][5]

Mojo supports GPU programming through a gpu package in its standard library.[18] A 2025 study by Oak Ridge National Laboratory researchers presented at the SC25 WACCPD workshop found Mojo's GPU kernels broadly competitive with CUDA and HIP for memory-bound workloads on Nvidia and AMD accelerators, while noting performance gaps for atomic operations and fast-math compute-bound workloads on AMD GPUs.[43]

Programming examples

[edit source]

Functions in Mojo are declared with def. Earlier versions also provided an fn keyword for stricter, statically typed functions; fn was deprecated in 2026 in favor of using def for all functions.[44][45] Functions may declare typed parameters and return types:

def add(x: Int, y: Int) -> Int:
    """A typed addition."""
    return x + y

Variables may be declared explicitly with var, which gives block-level scope, or implicitly by assignment, which gives function-level scope matching Python's behavior:[46]

def main():
    var total = add(1, 2)  # explicitly declared
    doubled = total * 2    # implicitly declared
    print(doubled)

Mojo originally included a let keyword for immutable bindings;[39] it was removed from the language in 2024.[47]

Structs are Mojo's compile-time-laid-out alternative to Python classes. The @fieldwise_init decorator synthesizes a constructor from the declared fields, and traits such as Copyable declare supported behaviors:[18]

@fieldwise_init
struct Point(Copyable, Movable):
    var x: Int
    var y: Int

    def magnitude_squared(self) -> Int:
        return self.x * self.x + self.y * self.y

def main():
    p = Point(3, 4)
    print(p.magnitude_squared())  # 25

Mojo programs can import and use Python modules through the CPython runtime:[36]

from std.python import Python

def main() raises:
    math = Python.import_module("math")
    print(math.sqrt(2.0))

See also

[edit source]

References

[edit source]
  1. Sullivan, Mark (19 March 2024). "How Modular simplified AI software infrastructure". Fast Company. Retrieved 19 August 2024.
  2. "Mojo v1.0.0". Modular. 11 August 2026. Retrieved 12 August 2026.
  3. 1 2 3 4 5 Mojo🔥 is now open source!, 18 August 2026, retrieved 18 August 2026
  4. "Modular Platform".
  5. 1 2 3 4 5 "Mojo FAQ". Retrieved 18 August 2026.
  6. "Welcome to the Mojo standard library".
  7. 1 2 Howard, Jeremy (4 May 2023). "fast.ai - Mojo may be the biggest programming language advance in decades". fast.ai. Retrieved 28 May 2024.
  8. sylvaticus (14 March 2024). "Advantages of Julia vs Mojo". Julia Programming Language. Retrieved 19 August 2026.[self-published source]
  9. Deutscher, Maria (7 September 2023). "Modular makes its AI-optimized Mojo programming language generally available". Silicon Angle. Retrieved 11 September 2023.
  10. 1 2 Krzaczyński, Robert (9 November 2023). "Mojo Language SDK Available: Mojo Driver, VS Code Extension, and Jupyter Kernel". InfoQ.
  11. "Mojo: Programming language for all of AI". Modular.com. Retrieved 28 February 2024.
  12. Krzaczyński, Robert (19 July 2023). "Introduction to Mojo Programming Language". InfoQ.
  13. "Mojo programming manual". docs.modular.com. Modular. 2023. Retrieved 26 September 2023. Mojo is a programming language that is as easy to use as Python but with the performance of C++ and Rust. Furthermore, Mojo provides the ability to leverage the entire Python library ecosystem.
  14. "Why Mojo - A language for next-generation compiler technology". docs.modular.com. Modular. 2023. Retrieved 26 September 2023. While many other projects now use MLIR, Mojo is the first major language designed expressly for MLIR, which makes Mojo uniquely powerful when writing systems-level code for AI workloads.
  15. 1 2 3 Krill, Paul (4 May 2023). "Mojo language marries Python and MLIR for AI development". InfoWorld. Retrieved 28 May 2024.
  16. "Fn deprication as a Python superset". Modular. 16 March 2026. Retrieved 28 July 2026.
  17. 1 2 3 4 5 6 7 Yegulalp, Serdar (20 May 2026). "First look: Mojo 1.0 mixes Python and Rust". InfoWorld.
  18. 1 2 Bensen, Earl (12 August 2026). "Mojo Hits 1.0: AI Systems Language Locks In Stable API, Ending Three Years of Churn". Tech Times.
  19. "Should Julia use MLIR in the future?". Julia Programming Language. 20 February 2024. Retrieved 28 May 2024.
  20. "Modular Docs: Why Mojo". docs.modular.com. Retrieved 28 May 2024.
  21. "Mojo - A system programming language for heterogenous computing" (PDF). Archived from the original (PDF) on 28 May 2024.
  22. Claburn, Thomas (5 May 2023). "Modular finds its Mojo, a Python superset with C-level speed". The Register. Retrieved 8 August 2023.
  23. Thomason, James (21 May 2024). "Mojo Rising: The resurgence of AI-first programming languages". VentureBeat.
  24. "Mojo changelog". 13 February 2025.
  25. "A unified, extensible platform to superpower your AI". Modular.com. Retrieved 14 April 2024.
  26. "Mojo - It's finally here!". Modular.com. Retrieved 14 April 2024.
  27. "Mojo is now available on Mac". Modular.com. Retrieved 14 April 2024.
  28. "Modular open-sources its Mojo AI programming language's core components". SiliconANGLE. 28 March 2024. Retrieved 28 May 2024.
  29. "mojo/stdlib/README.md at nightly · modularml/mojo". GitHub. Retrieved 28 May 2024.
  30. "Modular: The path to Mojo 1.0". Modular. 5 December 2025. Retrieved 12 June 2026.
  31. "Mojo releases". Modular. Retrieved 12 June 2026.
  32. "Mojo v1.0.0". Modular. 11 August 2026. Retrieved 12 August 2026.
  33. "Modular Docs - Mojo programming manual". docs.modular.com. Retrieved 19 October 2023.
  34. "Modular Docs - Mojo programming manual". docs.modular.com. Retrieved 31 October 2023.
  35. 1 2 Yegulalp, Serdar (12 November 2025). "Revisiting Mojo: A faster Python?". InfoWorld.
  36. Lattner, Chris; Pienaar, Jacques (2019). MLIR Primer: A Compiler Infrastructure for the End of Moore's Law (Technical report). Retrieved 30 September 2022.
  37. Lattner, Chris; Amini, Mehdi; Bondhugula, Uday; Cohen, Albert; Davis, Andy; Pienaar, Jacques; Riddle, River; Shpeisman, Tatiana; Vasilache, Nicolas; Zinenko, Oleksandr (29 February 2020). "MLIR: A Compiler Infrastructure for the End of Moore's Law". arXiv:2002.11054 [cs.PL].
  38. 1 2 Yegulalp, Serdar (7 June 2023). "A first look at the Mojo language". InfoWorld.
  39. "Mojo v25.4 release notes". GitHub. Modular. 18 June 2025. Retrieved 12 June 2026.
  40. "Modular Docs: Ownership and borrowing". Modular. Retrieved 29 February 2024.
  41. "Ownership". mojolang.org. Modular. Retrieved 12 June 2026.
  42. Godoy, William F.; Melnichenko, Tatiana; Valero-Lara, Pedro; Elwasif, Wael; Fackler, Philip; Ferreira Da Silva, Rafael; Teranishi, Keita; Vetter, Jeffrey S. (25 September 2025). "Mojo: MLIR-Based Performance-Portable HPC Science Kernels on GPUs for the Python Ecosystem". arXiv:2509.21039 [cs.DC].
  43. "Functions". mojolang.org. Modular. Retrieved 12 June 2026.
  44. "Mojo v26.2 release notes". GitHub. Modular. 19 March 2026. Retrieved 12 June 2026.
  45. "Variables". mojolang.org. Modular. Retrieved 12 June 2026.
  46. "Mojo v24.1 release notes". GitHub. Modular. 29 February 2024. Retrieved 12 June 2026.
[edit source]