Mojo (programming language)
Mojo is a specialized artificial intelligence (AI) programming language developed by Modular Inc. First released in May 2023, it is designed to become a superset of Python, with the performance of C, unparalleled programmability of hardware acceleration and extensibility of deep learning models.
Designed by | Chris Lattner |
---|---|
Developer | Modular Inc. |
First appeared | 2023 |
OS | Cross-platform |
Filename extensions | .mojo, .🔥 (the fire emoji / the U+1F525 Unicode character) |
Website | www |
Influenced by | |
Python, Rust |
Origin design and development
Mojo was first released internally by Modular Inc. in September, 2022,[1] with advanced compilation features powered by the MLIR, the Multi-Level Intermediate Representation compiler framework.[2][3][4]
Its type system is hybrid (something between static and dynamic), given that the developer can opt-in for high performance static typing by choosing the keyword (between `fn` and `def`) to define her function.
The companion Modular Inference Engine[5] is an AI infrastructure that simplifies the AI development workflow and reduces inference latency in order to scale AI products.
Similarity with Python
Mojo programming language is fully compatible to Project Jupyter ecosystem. It's not yet fully compatible with Python code, i.e. provides a subset of its syntax, e.g. missing (Python) classes, but can call existing Python 3.x code (by reusing the CPython runtime). It also has integration to transparently import Clang C/C++ modules, can transparently generate a foreign function interface between C/C++ and Mojo. Further, it also adds features that enable performant low-level programming: "fn" for creating typed, compiled functions and "struct" for memory-optimized alternatives to classes. A struct in Mojo is similar to a Python class: they both support methods, fields, operator overloading, decorators for meta programming.
Mojo has a borrow checker, an influence from Rust, and in that way is dissimilar to Python.
References
- "Mojo🔥 changelog".
- "Mojo language marries Python and MLIR for AI development".
- Lattner, Chris; Pienaar, Jacques (2019). "MLIR Primer: A Compiler Infrastructure for the End of Moore's Law". Retrieved 2022-09-30.
{{cite journal}}
: Cite journal requires|journal=
(help) - Lattner, Chris; Amini, Mehdi; Bondhugula, Uday; Cohen, Albert; Davis, Andy; Pienaar, Jacques; Riddle, River; Shpeisman, Tatiana; Vasilache, Nicolas; Zinenko, Oleksandr (2020-02-29). "MLIR: A Compiler Infrastructure for the End of Moore's Law". arXiv:2002.11054 [cs.PL].
- "Modular Inference Engine".