MITB Banner

This New Programming Language is Likely to Replace Python

Who knows? Mojo might be just another ‘Julia moment’ in the making, or might actually be the language of the future
Share
This New Programming Language Likely to Replace Python
Listen to this story

AI infrastructure company, Modular AI, recently unveiled Mojo, a new programming language that combines the syntax of Python along with the portability and speed of C, making it ideal for both research and production. 

Besides this, in the Product Launch 2023 Keynote, Tim Davis and Chris Lattner, the  person behind LLVM and Swift fame also released one of the fastest, unified inference engines called Modular Platform

https://twitter.com/Modular_AI/status/1653436642248781825

The creators of Mojo say that it had no intention of creating a new programming language. “But as we were building our platform with the intent to unify the world’s ML/AI infrastructure, we realised that programming across the entire stack was too complicated,” reads the blog

This means building a programming language with powerful compile-time metaprogramming, integration of adaptive compilation techniques, caching throughout the compilation flow, and other things that are not supported by existing languages. That is the direction that Mojo is heading towards. The team claims it is 35000X faster than Python.

Some of the key features are:

  • Native support for multiple hardware backends: Mojo allows for utilization of CPUs, GPUs, TPUs, and custom ASICs, catering to the strengths of each hardware type.
  • High-level syntax and semantics: Mojo’s high-level syntax and semantics are comparable to Python, making it easy for Python-savvy developers to learn and use.
  • Automatic parallelisation: Mojo simplifies writing of efficient, parallel code through automatic parallelisation across multiple hardware backends, without requiring low-level parallelisation knowledge.
  • Type inference and checking: Mojo offers a type inference and checking system, catching compile-time errors and reducing the likelihood of runtime errors.
  • Static compilation: Mojo is statically compiled, resulting in faster execution times and better optimization as code is compiled before execution.

New Programming Language, Really? 

Looks like Julia, the one that was touted as the Python replacement for its scalability and one of the most embraced programming languages of the last few years, competing with Rust, finally has another competitor. 

Moreover, according to the documentation of Mojo, instead of starting from scratch, the programming language will leverage the entire ecosystem of Python libraries, while also being built on a brand new codebase. This, along with the high computational ability of C and C++ will enable AI Python developers to rely on Mojo, instead of falling back on C or C++.

One of the major motivations behind building the new programming language according to the developers was that most of the modern programming systems rely on accelerators like GPU for operations, and only “fall back” on main CPUs for supporting operations like data loading, pre and post processing, and integrations into foreign system written in other languages. The company wanted to support the full gamut of this into one language

Moreover, to not build and innovate a new syntax or community, the company decided to go with Python and its ecosystem. A very smart move indeed!

Mojo is also going to remain open-source till it becomes the superset of Python 3. 

Competitions Galore

According to the Stack Overflow Developer Survey 2022, Rust is the most loved programming language, that too for the last seven years continuously. The problem with Rust is its complex syntax, making it a difficult steep learning curve. But even then, Rust is used by Meta, Dropbox, with Google planning to implement it as well. 

In the same survey, Julia ranked in the top 5 of the most loved languages, defeating Python. Same was the case the year before that. Viral Shah, the co-creator of Julia, in a decade old interview with AIM, said, “We wanted a language that did not trade-off performance for productivity and instead provided both high performance and high productivity.” 

Interestingly, Elon Musk had recently tweeted about how AGI will not be built on Python, but on Rust. This comes after him saying that he is a fan of Rust last year. To this thread, some users replied that they are on the side of Chris Lattner, and hope that it’s Swift, one of the earlier offerings of Lattner. Now, Modular said that “What if it’s the best of all of them?”

Addressing a lot of these questions on HackerNews about the comparison being made with Julia and Rust, and also future plans to compete with Python, Chris Lattner, one of the co-creators, praises Julia as a “wonderful language and a wonderful community,” calling himself as a super fan. Addressing the differences between Julia and Mojo, he stresses on the point that Mojo has a bunch of technical advancements when it comes to languages like Swift, Rust, C++, and even Julia, because it has learnt from them, and built over them.

He further adds that there is definitely space in the AI/ML landscape for another language that makes it easier to deploy and scale down models, while also supporting the full Python ecosystem. He further said, “Julia is far more mature and advanced in many ways.” Interesting how Lattner looks at a problem and decides to make a new programming language altogether, as pointed out by a Twitter user. 

Though the developers have been humble about how they are taking the approach with Python, the community on HackerNews and Twitter is all out comparing it with Python. 

A Game Changer?

Python, or even Julia, isn’t a preferred programming language when it comes to systems programming, but mostly for AI model building. Though it overcomes that limitation with low-level binding to C and C++ for building libraries. But building these hybrid libraries is a complicated task that requires the knowledge of C and C++ as well. This is where Mojo comes in and makes it into a one integratable and backwards compatible Python-like language – “Pythonic-C”

But on the other hand, whenever there is a new technology coming in place, there are the sceptics and naysayers, who sometimes also bring up interesting points. While some people on Hacker News forum are arguing that this might be a Python replacement, some are still sceptical about the performance improvement that the creators of the language promise. Some even don’t call it ‘Pythony’, which the developers behind the language have made efforts to stay away from. 

Another person on the forum calls Mojo the final nail in the coffin for “Julia as a replacement for Python”. Maybe Julia has missed out on its window of opportunity to replace Python, and Mojo is here to do the job. Still, the arena of programming languages remains unpredictable.

Moreover, this might be just another Julia moment in the world of programming, with Python syntax. Anyway, OpenAI is on a somewhat similar mission with Triton, their own programming language. 

PS: The story was written using a keyboard.
Picture of Mohit Pandey

Mohit Pandey

Mohit dives deep into the AI world to bring out information in simple, explainable, and sometimes funny words. He also holds a keen interest in photography, filmmaking, and the gaming industry.
Related Posts

Download our Mobile App

CORPORATE TRAINING PROGRAMS ON GENERATIVE AI

Generative AI Skilling for Enterprises

Our customized corporate training program on Generative AI provides a unique opportunity to empower, retain, and advance your talent.

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox
Recent Stories

Featured

Subscribe to The Belamy: Our Weekly Newsletter

Biggest AI stories, delivered to your inbox every week.

AI Courses & Careers

Become a Certified Generative AI Engineer

AI Forum for India

Our Discord Community for AI Ecosystem, In collaboration with NVIDIA. 

AIM Conference Calendar

Immerse yourself in AI and business conferences tailored to your role, designed to elevate your performance and empower you to accomplish your organization’s vital objectives. Revel in intimate events that encapsulate the heart and soul of the AI Industry.

Flagship Events

Rising 2024 | DE&I in Tech Summit

April 4 and 5, 2024 | 📍 Hilton Convention Center, Manyata Tech Park, Bangalore

MachineCon GCC Summit 2024

June 28 2024 | 📍Bangalore, India

MachineCon USA 2024

26 July 2024 | 583 Park Avenue, New York

Cypher India 2024

September 25-27, 2024 | 📍Bangalore, India

Cypher USA 2024

Nov 21-22 2024 | 📍Santa Clara Convention Center, California, USA

Data Engineering Summit 2024

May 30 and 31, 2024 | 📍 Bangalore, India

Download the easiest way to
stay informed