Content deleted Content added
→Features: citations that actually talk about open source plans |
m Replaced 1 bare URLs by {{Cite web}}; Replaced "Archived copy" by actual titles |
||
(19 intermediate revisions by 15 users not shown) | |||
Line 13:
}}
| family = [[Python (programming language)|Python]]
| designer = [[Chris Lattner]]<ref>{{cite web |url=https://www.fastcompany.com/91033509/modular-most-innovative-companies-2024 |title=How Modular simplified AI software infrastructure |
| developer = Modular Inc.
| latest release version =
| latest release date =
| latest preview version =
| latest preview date = {{start date and age|
| typing = {{cslist|
[[Affine type system|Affine]]|
Line 29:
}}
| operating system = [[Cross-platform software|Cross-platform]]: [[Linux]], [[macOS]]
| license = [[Apache License 2.0|Apache 2.0]] with LLVM Exceptions<ref name="opensource">{{Cite web |last=Modular Team |title=Modular: The Next Big Step in Mojo🔥 Open Source |date=28 March 2024 |url=https://www.modular.com/blog/the-next-big-step-in-mojo-open-source |access-date=2024-11-09 |publisher=Modular |language=en |archive-date=2024-10-09 |archive-url=https://web.archive.org/web/20241009144412/https://www.modular.com/blog/the-next-big-step-in-mojo-open-source |url-status=live}}</ref>
| year = {{Start date and age|2023}}
| file ext = {{Mono|.
| website = {{URL|www.modular.com/mojo}}
| wikibooks =
| implementations =
| dialects =
| influenced by = [[Python (programming language)|Python]], [[Cython]],
| influenced =
}}
'''Mojo''' is a [[programming language]] in the [[Python (programming language)|Python]] family that is currently under development.<ref name="MojoProgrammingManual_(2023)">{{cite web |url=https://docs.modular.com/mojo/programming-manual.html |title=Mojo programming manual |date=2023 |website=docs.modular.com |publisher=Modular |access-date=2023-09-26 |quote=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.}}</ref><ref name="Modular-WhyMojo_(2023)">{{cite web |url=https://docs.modular.com/mojo/why-mojo.html |title=Why Mojo - A language for next-generation compiler technology |date=2023 |website=docs.modular.com |publisher=Modular |access-date=2023-09-26 |quote=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.}}</ref><ref name="InfoWorld">{{cite web |last1=Krill |first1=Paul |title=Mojo language marries Python and MLIR for AI development |url=https://www.infoworld.com/article/3695588/mojo-language-marries-python-and-mlir-for-ai-development.html |website=InfoWorld |language=en |date=4 May 2023}}</ref> It is available both in browsers via [[Project Jupyter#Jupyter Notebook|Jupyter notebooks]],<ref name="InfoWorld"/><ref name="IWFirst">{{cite news |last1=Yegulalp |first1=Serdar |title=A first look at the Mojo language |url=https://www.infoworld.com/article/3697739/a-first-look-at-the-mojo-language.html |work=InfoWorld |date=7 June 2023 |language=en}}</ref> and locally on [[Linux]] and [[macOS]].<ref>{{cite news |last1=Deutscher |first1=Maria |title=Modular makes its AI-optimized Mojo programming language generally available |url=https://siliconangle.com/2023/09/07/modular-makes-ai-optimized-mojo-programming-language-generally-available/ |work=Silicon Angle |date=7 September 2023 |access-date=2023-09-11 |language=en}}</ref><ref name="macOS_(2023)">{{cite web |url=https://x.com/Modular/status/1715024755093287042 |title=Mojo for Mac OS |publisher=Modular |access-date=2023-10-19}}</ref> Mojo aims to combine the usability of a [[high-level programming language]], specifically [[Python (programming language)|Python]], with the performance of a [[system programming language]] such as [[C++]], [[Rust (programming language)|Rust]], and [[Zig (programming language)|Zig]].<ref>{{Cite web |title=Mojo: Programming language for all of AI |url=https://www.modular.com/max/mojo |access-date=2024-02-28 |website=Modular.com |language=en}}</ref> {{As of|
Mojo builds on the Multi-Level Intermediate Representation ([[MLIR (software)|MLIR]]) compiler [[software framework]], instead of directly on the lower level [[LLVM]] compiler framework
== Origin and development history ==
The Mojo programming language was created by Modular Inc, which was founded by [[Chris Lattner]], the original [[Software architect|architect]] of the [[Swift (programming language)|Swift]] programming language and [[LLVM]], and Tim Davis, a former [[Google]] employee.<ref name="claburn2023">{{cite news |last1=Claburn |first1=Thomas |date=2023-05-05 |url=https://www.theregister.com/2023/05/05/modular_struts_its_mojo_a/ |title=Modular finds its Mojo, a Python superset with C-level speed |access-date=2023-08-08 |work=The Register}}</ref>
According to public change logs, Mojo development goes back to 2022.<ref>{{cite web|url=https://docs.modular.com/mojo/changelog.html#september-2022|title=Mojo changelog|date=13 February 2025 }}</ref> In May
In March
== Features ==
Line 55:
The language also provides a [[borrow checker]], an influence from [[Rust (programming language)|Rust]].<ref>{{Cite web |title=Modular Docs: Ownership and borrowing |url=https://docs.modular.com/mojo/manual/values/ownership.html |access-date=2024-02-29 |publisher=Modular}}</ref> Mojo {{Mono|def}} functions use value semantics by default (functions receive a copy of all arguments and any modifications are not visible outside the function), while [[Python (programming language)|Python]] functions use reference semantics (functions receive a reference on their arguments and any modification of a mutable argument inside the function is visible outside).<ref>{{Cite web |title=Mojo programming manual |url=https://docs.modular.com/mojo/programming-manual.html |access-date=2023-06-11 |publisher=Modular |archive-url=https://web.archive.org/web/20230611225929/https://docs.modular.com/mojo/programming-manual.html |archive-date=2023-06-11 |quote=All values passed into a Python def function use reference semantics. This means the function can modify mutable objects passed into it and those changes are visible outside the function. However, the behavior is sometimes surprising for the uninitiated, because you can change the object that an argument points to and that change is not visible outside the function. All values passed into a Mojo function use value semantics by default. Compared to Python, this is an important difference: A Mojo {{mono|def}} function receives a copy of all arguments: it can modify arguments inside the function, but the changes are not visible outside the function.}}</ref>
The language is not open source, but it is planned to be made open source in the future.<ref>{{Cite web |title=Open Source {{!}} Mojo🔥 FAQ {{!}} Modular Docs |url=https://docs.modular.com/mojo/faq#open-source |access-date=2024-11-09 |website=docs.modular.com |language=en}}</ref><ref name="opensource" /><ref>{{Cite web |title=Modular:
== Programming examples ==
Line 62:
Basic arithmetic operations in Mojo with a {{mono|def}} function:
<syntaxhighlight lang="
def sub(x, y):
"""A pythonic subtraction."""
Line 71:
and with an {{mono|fn}} function:
<syntaxhighlight lang="
fn add(x: Int, y: Int) -> Int:
"""A rustacean addition."""
Line 81:
Variable declaration and usage in Mojo:
<syntaxhighlight lang="
fn main():
let x = 1
|