設計者 | 克里斯·拉特納 |
---|---|
實作者 | Modular公司 |
发行时间 | 2023年 |
操作系统 | 跨平臺 |
文件扩展名 | .mojo, .🔥 |
網站 | www |
啟發語言 | |
Python、Rust |
Mojo是由Modular公司开发的一种基于MLIR编译框架的编程语言,旨在为人工智能等领域的软件开发提供统一的编程框架。[2][3][4][5][6][3][7][8]
Mojo语言为Python语言的超集[7][9],故也被称为Python++ 。同时,它还具有C++的速度与Rust的安全性。[10][5][11][12][13][2][14]
Mojo语言于2023年5月推出,最初仅能在浏览器的Jupyter笔记本中使用[3][15],2023年9月起开始提供Linux本地版本。[16]Modular公司团队还开发了支持Mojo语言的Visual Studio Code扩展。[17]
2022年,Swift语言创始人克里斯·拉特纳和Google机器学习产品经理蒂姆·戴维斯(Tim Davis)共同创立了Modular公司。[18]2022年9月,Modular公司在内部发布了Mojo的初始版本[19],支持MLIR编译器框架提供的高级编译功能。[3][20]
Mojo语言的类型系统是同时包含静态类型和动态类型的混合系统,开发者可以为其编写的函数自由选择是否使用高性能静态类型。
Mojo语言旨在与Jupyter生态系统完全兼容。目前,其尚未做到完全与Python 3.x源代码兼容,而仅支持Python语法的子集。在此基础上,Mojo还支持Python没有的高性能低级编程语言的功能,如能使用“fn”关键字创建类型化、可编译的函数,或使用“struct”关键字创建可优化内存使用的类。[15]Mojo还能通过CPython来调用现有的Python 3.x代码。此外,Mojo借鉴Rust引入了Python所没有的借用检查器。
使用Mojo语言编写的Hello world程序与Python相同:
print('Hello, World!')
We just released a new version of Mojo (v0.3.0)
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.
Mojo leverages MLIR, which enables Mojo developers to take advantage of vectors, threads, and AI hardware units.
Eine neue Programmiersprache für Machine Learning, eine Art Python++?
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.
Mojo is still young, but it is designed to become a superset of Python over time.
Mojo: a high performance 'Python++' language for compute
Maybe it’s better to say Mojo is Python++
From the creators of LLVM, Clang, and Swift. A better Python, Python++