Mojo

出自Local Chinese Wikipedia
imported>Nullizer2025年10月26日 (日) 02:10的修訂 (使用DisamAssist清理消歧义链接:Rust(链接至Rust (编程语言); 链接至Rust (编程语言); 链接至Rust (编程语言))。)
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)
跳至導覽 跳至搜尋
Mojo
編程範型多範式指令式(為主),函數式泛型
語言家族Python
設計者克里斯·拉特納
實作者Modular公司
面市時間2023年,​3年前​(2023
型態系統
作業系統跨平臺
許可證專有
副檔名.🔥(火焰emoji/U+1F525)、.mojo
網站www.modular.com/mojo
受影響於
PythonCythonCC++RustSwiftZig

Mojo是由Modular公司開發的一種基於MLIR編譯器框架英語MLIR (software)程式語言,旨在為人工智慧等領域的軟體開發提供統一的編程框架。[1][2][3][4][5][2][6][7]

Mojo語言為Python語言超集[6][8],故也被稱為Python++ 。同時,它還具有C++的速度與Rust的安全性。[9][4][10][11][12][1][13]

Mojo語言於2023年5月推出,最初僅能在瀏覽器的Jupyter筆電中使用[2][14],2023年9月起開始提供Linux本地版本。[15]Modular公司團隊還開發了支援Mojo語言的Visual Studio Code擴充。[16]

原始設計與開發[編輯]

2022年,Swift語言創始人克里斯·拉特納Google機器學習產品經理蒂姆·戴維斯(Tim Davis)共同創立了Modular公司。[17]2022年9月,Modular公司在內部發布了Mojo的初始版本[18],支援MLIR編譯器框架提供的進階編譯功能。[2][19]

Mojo語言的型別系統是同時包含靜態型別和動態型別的混合系統,開發者可以為其編寫的函式自由選擇是否使用高效能靜態型別。

與Python的對比[編輯]

Mojo語言旨在與Jupyter生態系統完全相容。目前,其尚未做到完全與Python 3.x原始碼相容英語Source-code compatibility,而僅支援Python語法的子集。在此基礎上,Mojo還支援Python沒有的高效能低階程式語言的功能,如能使用「fn」關鍵字建立類型化可編譯函式,或使用「struct」關鍵字建立可最佳化主記憶體使用的[14]Mojo還能通過CPython來呼叫現有的Python 3.x代碼。此外,Mojo借鑑Rust引入了Python所沒有的借用檢查器。

實例[編輯]

使用Mojo語言編寫的Hello world程式與Python相同:

print('Hello, World!')

參考文獻[編輯]

  1. 1.0 1.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. 
  2. 2.0 2.1 2.2 2.3 Krill, Paul. Mojo language marries Python and MLIR for AI development. InfoWorld. 4 May 2023 [2023-09-27]. (原始內容存檔於2023-05-05) (English). 
  3. 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. 
  4. 4.0 4.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) (Deutsch). Eine neue Programmiersprache für Machine Learning, eine Art Python++? 
  5. 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. 
  6. 6.0 6.1 Claburn, Thomas. Modular reveals Mojo, Python superset with C-level speed. The Register. 5 May 2023 [2023-09-27]. (原始內容存檔於2023-09-02) (English). 
  7. Pandey, Mohit. This New Programming Language is Likely to Replace Python. Analytics India Magazine. 3 May 2023 [2023-09-27]. (原始內容存檔於2023-05-30). 
  8. 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. 
  9. 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 
  10. 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++ 
  11. May, Eira. Like Python++ for AI developers. stackoverflow.blog. Stack Exchange, Inc. 2023-09-25 [2023-09-26]. (原始內容存檔於2023-10-04). 
  12. 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++ 
  13. 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). 
  14. 14.0 14.1 Yegulalp, Serdar. A first look at the Mojo language. InfoWorld. 7 June 2023 [2023-09-27]. (原始內容存檔於2023-08-18) (English). 
  15. Deutscher, Maria. Modular makes its AI-optimized Mojo programming language generally available. Silicon Angle. 7 September 2023 [2023-09-11]. (原始內容存檔於2023-10-23) (English). 
  16. Mojo for Visual Studio Code. marketplace.visualstudio.com. Microsoft. [2023-09-26]. (原始內容存檔於2023-10-14). 
  17. Claburn, Thomas. Modular finds its Mojo, a Python superset with C-level speed. The Register. 2023-05-05 [2023-08-08]. (原始內容存檔於2023-09-02). 
  18. Mojo🔥 changelog. [2023-09-27]. (原始內容存檔於2023-11-01). 
  19. 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]. 

外部連結[編輯]