What is Mojo Programming language?

Mojo Lang - The TypeScript of "Python", The Real Future of Python?

5.7KReads
5 May, 2023

Alright, tech people, sh*ts about to get real . Today we are talking about - Mojo, the new programming language that's taking the AI (Python) world by storm.

But wait, what is Mojo, you ask? Simply put, in very very layman terms-

It is "TypeScript" of Python

Meaning???

By its "TypeScript" i mean, Mojo ain't an entirely different language!! Ain't no Sh*t. Its rather a Super-set of Python with some extra crazy features on top of it. If you don't wanna read all and just want the a sarcastic summary, watch this Fireship Video on Mojo Lang.

YouTube
YouTube

Write everything in one language

Write Python or scale all the way down to the metal. Program the multitude of low-level AI hardware. No C++ or CUDA required. Some of these features are:

  • PROGRESSIVE TYPES: Leverage types for better performance and error checking.
  • OWNERSHIP + BORROW CHECKER: Take advantage of memory safety without the rough edges.
  • ZERO COST ABSTRACTIONS: Take control of storage by inline-allocating values into structures.
  • PORTABLE PARAMETRIC ALGORITHMS: Leverage compile-time meta-programming to write hardware-agnostic algorithms and reduce boilerplate.
  • LANGUAGE INTEGRATED AUTO-TUNING: Automatically find the best values for your parameters to take advantage of target hardware.
  • and some other feautures like The full power of MLIR (Don't know WTF that is) , Parallel heterogenous runtime and and Fast compile times

The biggest selling point:- Its freaking Fast!!!!!!

Mojo Lang - The TypeScript of "Python", The Real Future of Python?

These Stats are by official Mojo website: modular.com/mojo. And if what they are claiming is true, then we are witnessing a TypeScript Moment in Python World.

Good News for Python People??

Well, since its super-set they don't have to learn an entire new language. As i said JavaScript People were easily able to start using TypeScript as its just a superset of JavaScript.

Smaple Code will look something like this:-

BTW you can use a fire emoji as file extension to tell its a Mojo file.
Example: FILE_NAME.🔥

def exp_buffer[dt: DType](data: ArraySlice[dt]):

  # Search for the best vector length
  alias vector_len = autotune(1, 4, 8, 16, 32)
  
  # Use it as the vectorization length
  vectorize[exp[dt, vector_len]](data)

Also, It's like Python on Steroids

I mean we all know Python for being too slow, and this will give python wings to fly across the heaven and 9 realms at speed of light.

Utilize the full power of the hardware, including multiple cores, vector units, and exotic accelerator units, with the world's most advanced compiler and heterogenous runtime. Achieve performance on par with C++ and CUDA without the complexity.

PARALLELIZATION Execution

Mojo leverages MLIR, which enables Mojo developers to take advantage of vectors, threads, and AI hardware units.

Mojo Lang - The TypeScript of "Python", The Real Future of Python?

Bottom ine, its freaking cool. If you want to try it out, visit thier official website and signup www.modular.com/get-started. Let me know your opinions, is its really that cool?? See you in the next Dot.