Mojo (programming language)
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 |
Mojo is a programming language developed by Modular Inc.[1][2][3] It was made accessible by browser in May, 2023[1][4] and locally on Linux in September, 2023.[5] The language is able to run some Python programs.[4] The developers have several goals to improve Mojo.[1][4]
Origin design and development
In 2022, the Modular company was founded by Chris Lattner, the original architect of the Swift programming language, and Tim Davis, an ML thought leader at Google.[6]
In September 2022, an initial build of Mojo was released internally by Modular Inc.[7] with advanced compilation features powered by the MLIR, the Multi-Level Intermediate Representation compiler framework.[8][1][9]
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 their function.
The companion Modular Inference Engine is includes a compiler and runtime.[10]
Comparison with Python
The Mojo programming language aims to be fully compatible with the Project Jupyter ecosystem. It's not yet fully source-compatible with Python 3.x code, only providing a subset of its syntax, e.g. missing keyword arguments for functions, the global keyword, list and dictionary comprehensions, and support for classes. Further, Mojo 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.[4] Mojo can call existing Python 3.x code by reusing the CPython runtime. Modular plans to add integration to transparently import Clang C/C++ modules and transparently generate a foreign function interface between C/C++ and Mojo.
Mojo has a borrow checker, an influence from Rust, and in that way is dissimilar to Python.
Programming examples
Hello world program:
print('Hello, World!')
See also
References
- ^ a b c d Krill, Paul (4 May 2023). "Mojo language marries Python and MLIR for AI development". InfoWorld.
- ^ Claburn, Thomas (5 May 2023). "Modular reveals Mojo, Python superset with C-level speed". The Register.
- ^ Pandey, Mohit (3 May 2023). "This New Programming Language is Likely to Replace Python". Analytics India Magazine.
- ^ a b c d Yegulalp, Serdar (7 June 2023). "A first look at the Mojo language". InfoWorld.
- ^ Deutscher, Maria (7 September 2023). "Modular makes its AI-optimized Mojo programming language generally available". Silicon Angle. Retrieved 2023-09-11.
- ^ Claburn, Thomas (2023-05-05). "Modular finds its Mojo, a Python superset with C-level speed". The Register. Retrieved 2023-08-08.
- ^ "Mojo🔥 changelog".
- ^ Lattner, Chris; Pienaar, Jacques (2019). MLIR Primer: A Compiler Infrastructure for the End of Moore's Law (Technical report). Retrieved 2022-09-30.
- ^ 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".