DEV Community

Maxim Saplin
Maxim Saplin

Posted on

Mojo🔥SDK has been released for Linux

From the creators of LLVM, Clang, and Swift. A better Python, Python++... Mojo is finally here.

3 months after the release of Jupiter online playground, one can download the SDK and play with Mojo in VSCode (on Linux with x86 CPU).

Image description

As a programming language, Mojo wants to be a superset of Python allowing it to run any Python code as-is while giving new constructs to solve well known problems.

As a platform, Mojo wants to be a 'Modular Stack' - an efficient hosting for AI/ML workloads.

Mojo today:

  • Has implemented a limited set of Python features (e.g. there are no classes)
  • Yet it has native interop with Python, making the whole ecosystem accessible
  • Has 'strict' mode disabling dynamic typing and enforcing type checks (fn vs def)
  • Promises C/C++ performance via static typing, native in-language support of SIMD extensions, and parallelism
  • Self-contained builds with small runtime (22kb 'Hello world' app)

In the future Mojo plans to close the gap with Python syntax and introduce support for more hardware (more CPUs and GPUs), macOS, and Windows.

Let's wish them a good luck 👍

Top comments (8)

Collapse
 
ilya0x profile image
ilya

I am very excited about Mojo.

Mojo uses the struct keyword that is similar to Python's class. Classes in Python are dynamic and slow, struct types are more similar to C/C++ and Rust: they have fixed memory layouts determined at compile time, optimizing them for machine-native performance.

When writing code for Mojo, you can declare specific variables using the keywords let and var. The let keyword signifies that a variable is unchangeable, while var indicates that it can be modified. This improves performance by enforcing restrictions at compile time.

Collapse
 
maximsaplin profile image
Maxim Saplin

Any luck playing with the SDK locally? "Hello world" worked for me yet when I tried importing external .py script, but it failed (docs.modular.com/mojo/programming-...)

Collapse
 
ilya0x profile image
ilya

I only have time for Mojo fun on Mondays and just setup the local SDK this week (I'm Windows and was hoping they'll release one for Win sooner then I was ready to play with it lol). So only tried "Hello world" so far. Will be trying this next Monday. Will report in then :)

Collapse
 
ilya0x profile image
ilya

Well, I tried it and it is not working.

  • tried surrounding the call in a 'try' block to get the error, but doesn't seem f strings work:
except Exception as e:
        print(f"An error occurred: {e}")
Enter fullscreen mode Exit fullscreen mode

Gets: error: expected ':' after 'except'

Thread Thread
 
maximsaplin profile image
Maxim Saplin

Same for me..

Thread Thread
 
ilya0x profile image
ilya

I'm frustrated yet excited lol
Frustrated it doesn't work and excited that we're so early in learning it. Learning a language as it is being developed is so awesome - hasn't happened for me since CSS in late 90s lol

Thread Thread
 
ilya0x profile image
ilya

Solved the issue! Had to install numpy in the Ubuntu environment:

$ sudo apt install python3-numpy
Enter fullscreen mode Exit fullscreen mode

Modular's Discord is awesome. Folks there are super knowledgeable and friendly.

Thread Thread
 
maximsaplin profile image
Maxim Saplin

Thanks! Will try it!