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).
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
vsdef
) - 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)
I am very excited about Mojo.
Mojo uses the
struct
keyword that is similar to Python'sclass
. 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
andvar
. Thelet
keyword signifies that a variable is unchangeable, whilevar
indicates that it can be modified. This improves performance by enforcing restrictions at compile time.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-...)
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 :)
Well, I tried it and it is not working.
Gets:
error: expected ':' after 'except'
Same for me..
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
Solved the issue! Had to install numpy in the Ubuntu environment:
Modular's Discord is awesome. Folks there are super knowledgeable and friendly.
Thanks! Will try it!