Mojo是由Modular公司开发的一种基于MLIR编译器框架英语MLIR (software)编程语言,旨在为人工智能等领域的软件开发提供统一的编程框架。[3][4][5][6][7][4][8][9]

Mojo
编程范型多范型指令式(为主),函数式泛型
语言家族Python
設計者克里斯·拉特納
實作者Modular公司
发行时间2023年,​3年前​(2023
当前版本
  • 1.0.0b1(2026年5月7日;测试版本)[1]
  • 26.2(2026年3月19日;穩定版本)[2]
編輯維基數據鏈接
型態系統
操作系统跨平臺
許可證专有
文件扩展名.🔥(火焰emoji/U+1F525)、.mojo
網站www.modular.com/mojo
受影响于
PythonCythonCC++RustSwiftZig

Mojo语言为Python语言超集[8][10],故也被称为Python++ 。同时,它还具有C++的速度与Rust的安全性。[11][6][12][13][14][3][15]

Mojo语言于2023年5月推出,最初仅能在浏览器的Jupyter笔记本中使用[4][16],2023年9月起开始提供Linux本地版本。[17]Modular公司团队还开发了支持Mojo语言的Visual Studio Code扩展。[18]

原始设计与开发

编辑

2022年,Swift语言创始人克里斯·拉特纳Google机器学习产品经理蒂姆·戴维斯(Tim Davis)共同创立了Modular公司。[19]2022年9月,Modular公司在内部发布了Mojo的初始版本[20],支持MLIR编译器框架提供的高级编译功能。[4][21]

Mojo语言的类型系统是同时包含静态类型和动态类型的混合系统,开发者可以为其编写的函数自由选择是否使用高性能静态类型。

与Python的对比

编辑

Mojo语言旨在与Jupyter生态系统完全兼容。目前,其尚未做到完全与Python 3.x源代码兼容英语Source-code compatibility,而仅支持Python语法的子集。在此基础上,Mojo还支持Python没有的高性能低级编程语言的功能,如能使用“fn”关键字创建类型化可编译函数,或使用“struct”关键字创建可优化内存使用的[16]Mojo还能通过CPython来调用现有的Python 3.x代码。此外,Mojo借鉴Rust引入了Python所没有的借用检查器。

实例

编辑

使用Mojo语言编写的Hello world程序与Python相同:

print('Hello, World!')

参考文献

编辑
  1. ^ https://github.com/modular/modular/releases/tag/max%2Fv26.3.0.
  2. ^ https://github.com/modular/modular/releases/tag/modular%2Fv26.2.0.
  3. ^ 3.0 3.1 Mojo🔥 programming manual. docs.modular.com. Modular. 2023 [2023-09-26]. (原始内容存档于2023-10-22). 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. 
  4. ^ 4.0 4.1 4.2 4.3 Krill, Paul. Mojo language marries Python and MLIR for AI development. InfoWorld. 4 May 2023 [2023-09-27]. (原始内容存档于2023-05-05) (英语). 
  5. ^ Mojo 🔥 — the programming language for all AI developers. www.modular.com. Modular. 2023 [2023-09-26]. (原始内容存档于2023-11-10). Mojo leverages MLIR, which enables Mojo developers to take advantage of vectors, threads, and AI hardware units. 
  6. ^ 6.0 6.1 Hahn, Silke. Jenseits von Python: Mojo baut Brücke zwischen Python und C für Machine Learning. www.heise.de. Heise Medien GmbH & Co. KG. 2023-05-09 [2023-09-26]. (原始内容存档于2023-09-26) (德语). Eine neue Programmiersprache für Machine Learning, eine Art Python++? 
  7. ^ Why Mojo🔥 - A language for next-generation compiler technology. docs.modular.com. Modular. 2023 [2023-09-26]. (原始内容存档于2023-05-05). 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. 
  8. ^ 8.0 8.1 Claburn, Thomas. Modular reveals Mojo, Python superset with C-level speed. The Register. 5 May 2023 [2023-09-27]. (原始内容存档于2023-09-02) (英语). 
  9. ^ Pandey, Mohit. This New Programming Language is Likely to Replace Python. Analytics India Magazine. 3 May 2023 [2023-09-27]. (原始内容存档于2023-05-30). 
  10. ^ Welcome to Mojo 🔥. github.com. Modular. 2023 [2023-09-26]. (原始内容存档于2023-10-25). Mojo is still young, but it is designed to become a superset of Python over time. 
  11. ^ Ramarao, Pramod. Mojo🔥 - It’s finally here!. www.modular.com. Modular. 2023-09-07 [2023-09-26]. (原始内容存档于2023-11-12). Mojo: a high performance 'Python++' language for compute 
  12. ^ Howard, Jeremy. Mojo may be the biggest programming language advance in decades. www.fast.ai. fast.ai. 2023-05-04 [2023-09-26]. (原始内容存档于2023-10-17). Maybe it’s better to say Mojo is Python++ 
  13. ^ May, Eira. Like Python++ for AI developers. stackoverflow.blog. Stack Exchange, Inc. 2023-09-25 [2023-09-26]. (原始内容存档于2023-10-04). 
  14. ^ Saplin, Maxim. Mojo🔥SDK has been released for Linux. dev.to. DEV Community. 2023-09-07 [2023-09-26]. (原始内容存档于2023-10-22). From the creators of LLVM, Clang, and Swift. A better Python, Python++ 
  15. ^ May, Eira. Mojo: The usability of Python with the performance of C. stackoverflow.blog. Stack Exchange, Inc. 2023-09-22 [2023-09-26]. (原始内容存档于2023-10-08). 
  16. ^ 16.0 16.1 Yegulalp, Serdar. A first look at the Mojo language. InfoWorld. 7 June 2023 [2023-09-27]. (原始内容存档于2023-08-18) (英语). 
  17. ^ Deutscher, Maria. Modular makes its AI-optimized Mojo programming language generally available. Silicon Angle. 7 September 2023 [2023-09-11]. (原始内容存档于2023-10-23) (英语). 
  18. ^ Mojo for Visual Studio Code. marketplace.visualstudio.com. Microsoft. [2023-09-26]. (原始内容存档于2023-10-14). 
  19. ^ Claburn, Thomas. Modular finds its Mojo, a Python superset with C-level speed. The Register. 2023-05-05 [2023-08-08]. (原始内容存档于2023-09-02). 
  20. ^ Mojo🔥 changelog. [2023-09-27]. (原始内容存档于2023-11-01). 
  21. ^ Lattner, Chris; Amini, Mehdi; Bondhugula, Uday; Cohen, Albert; Davis, Andy; Pienaar, Jacques; Riddle, River; Shpeisman, Tatiana; Vasilache, Nicolas; Zinenko, Oleksandr. MLIR: A Compiler Infrastructure for the End of Moore's Law. 2020-02-29. arXiv:2002.11054  [cs.PL]. 

外部链接

编辑

📚 Artikel Terkait di Wikipedia

二進制代碼的兼容性

味着它可以运行与另一计算机系统相同的可执行代码,通常是通用计算机中央处理器(CPU)的机器码。另一方面,源代码兼容性(英语:Source-code compatibility)意味着程序需要重新编译或解释才能够在兼容系统上运行。 对于通用操作系统上的已编译程序,二进制兼容性通常不仅意味着两个计算机

KDE Frameworks

5將會以每個月為基礎釋出且使用git。 平台發布是開始一個系列(版本號X.0)的主要發布。這些版本可以打破二進制檔案和原始碼相容性(英语:source code compatibility),或者換句話說,所有以下版本(X.1, X.2, ...)將保證原始碼和二進制兼容性(应用程序接口及应用二进制接口)。例如,該軟體使用KDE

连字号

8859-1 compatibility (页面存档备份,存于互联网档案馆). Unicode Technical Committee document L2/03-155R, June 2003. Hyphenator.js, Hyphenator.js source code (页面存档备份,存于互联网档案馆)

ScyllaDB

$25 Million to Open Source Amazon DynamoDB-compatible API. [2024-10-31]. (原始内容存档于2024-12-19).  ScyllaDB: Cassandra compatibility at 1.8 million requests

开源操作系统比较

互联网档案馆的存檔,存档日期2006-10-06. OpenSolaris FAQ: Does the OpenSolaris project include source code for both the SPARC and x64/x86 architectures?. Opensolaris.org. 26 October

Android

Android Open Source Project Frequently Asked Questions: Compatibility. source.android.com. [2011-03-13]. (原始内容存档于2010-08-03).  Android Compatibility Definition

中日韓統一表意文字

Consortium. Code chart: CJK Compatibility Ideographs (PDF). [2024-11-14]. (原始内容存档 (PDF)于2025-01-30).  Unicode Consortium. Code chart: CJK Compatibility Ideographs

Tizen

1.0 Larkspur SDK and Source Code Release. Tizen.org. [2012-11-22]. (原始内容存档于2012-05-09).  Tizen 2.0 Magnolia SDK and Source Code Release. Tizen.org. [2013-02-19]