Finally got me to unsubscribe. I'm surprised that the whole crew of them were cool with reposting the snippet of DHH calling linux maintainers "clowns and goblins" amongst other things.
This is really exciting. I've been using Mojo off and on for side projects over the last two years.
(copying from some previous Mojo threads) It's got an ownership system adjacent to Rust, comptime similar to Zig, and a first class dependent type system. Even more exciting, is that uses LLVM (to the best of my understanding) in some novel ways and for more optimizations.
Hm, in docs they say that dependent type system is not first class seems.
Is it even dependent? More like refinement types, which seems will be in Rust too.Also HN recently mentioned Rust building similar llvm based integration with GPU.
But compared with Python, Julia, Matlab, R, Rust, C, C++ - Mojo feel relief for working with numerics.
I don't agree at all with your last paragraph. MATLAB and Julia are lovely for numerics, maths is terse and looks like maths! Mojo is hobbled by choosing Python style syntax, which does not lend itself well to maths.
WRT the type system, I agree MATLAB is a mess but Julia's multiple dispatch feels more like maths than any other language I've tried.
I coded Matlab in uni, never got it. And had to look Julia code. I have to learn it to read. I am more SEng rather then Sci or Quant. And on compile time types. So for me Julia is foreign and forces me to look both Python and Julia.
I think problems is too strong a word, it's just how the syntax looks. And of course it's far better than say C++. But specifically, the lack of native vectors/matrices and very few infix operators (e.g dot product, and matrix multiplication with @ is clunky). Explicit but generic broadcasting using `.` also helps.
The way that types interact with methods _feels_ like maths. I.e. you have a method made up of mathematical operators, if you swap out an input, it typically does the natural and correct thing.
Having written a lot of Mojo over the last two year, just for fun, it's a really cool language. Ownership model adjacent to Rust, comptime in the realm of Zig, rich type system, first class SIMD support, etc.
Performance wise it's the first language in long time that isn't just an LLVM wrapper. LLVM is still involved, but they are using it differently than say, Rust or Zig.
Very excited for Mojo once it's open sourced later this year.
> LLVM is still involved, but they are using it differently than say, Rust or Zig.
Chris Lattner said in a Developer Voices podcast interview:
"Swift in a way was syntactic sugar for LLVM, at the very bottom of the stack it could talk directly to LLVM primitives. Mojo does basically that same trick, but it supercharges it by moving to this MLIR world."
Mojo is much faster than Rust, but slower than Go. I don't have much experience with Zig.
Mojo is designed to be very fast to compile, so many decisions were made to keep the core language simple, one example is in `where` clause, the checking there happens entirely in the parser. It can be stupid in situations where other languages are smart, and make you explicitly do checks that could be inferred in other languages. But on the other hand, it can be very fast since it doesn't have to do all the complicated resolving.
Another reason is how LLVM is used, Modular found ways to parralize LLVM code generation by introducing novel techniques that'll likely become a lot more popular with other languages.
I think they had a good dive here
https://www.youtube.com/watch?v=SEwTjZvy8vw
The gist is that MLIR (unlike LLVM) was designed to be multithreaded so the whole stack above LLVM IR is parallel, and then LLVM is used as a per-function codegen tool in parallel, so although LLVM itself is single threaded there are multiple seperate contexts of it. also I think they wrote their own linker.
Well, LLVM itself is still single-threaded; they just designed Mojo's compiler in such a way that the code generation part can be parallelised, which is something you can do if you understand LLVM from top to bottom. As far as I can see, no other production-grade LLVM consumer has been able to make it parallel; the single-threaded nature remains a major performance bottleneck.
> Modular found ways to parralize LLVM code generation by introducing novel techniques
> The novelty is in parrelizing LLVM, which is traditionally a single-thread code generator.
You said they parallelized LLVM with novel techniques, but then claimed the novelty is the very act of parallelizing it. That's circular, you still haven't explained what are the novel techniques?
Here is a presentation talking about the parallelization techniques, I skipped to the relevant part but the entire presentation is helpful in understanding how Mojo's compiler works: https://youtu.be/yuSBEXkjfEA?t=813&si=MlB7IsBDsj3o-PTX
From experience, Zig compile times are at least as fast as Go for debug builds that don't need to do linking with C libraries, etc. It does have to use LLVM for release builds however which is a lot slower.
Mojo compiles with O2 by default, it is similar to Go here. Release build is the default, debug is something you opt into. It is still very fast nonetheless
Me too! I've been using it for bioinformatics related work, and it is absolutely fantastic. I can't wait for it to hit fully open source status so it can be easily recommended.
"requires" is a strong word, but I implemented an alignment kernel that can do alignments on the GPU.
Overall I think there is going to be a lot of "old" gpu compute hanging around, and now that writing kernels is a lot easier than it has been, we might as well try and see what algorithms we can get working there.
I originally picked up Mojo for the SIMD, not for the GPU kernels. The SIMD usability in Mojo is outstanding.
I have been pretty hopeful about Mojo as I find many of the modern compiled languages these days requires an surprisingly excessive amount of ceremony just to open a file and read it line by line. At least this is the case with Go, as I've written about [1].
If Mojo is providing any kind of python like experience in this matter, I will be all into it again (it lacked these features when I last tried).
I'm really quite divided about Rust vs Mojo for bioinformatics in the future.
The syntax i Mojo really seems to shine a lot ... though I still wonder if the train has already left now that so much bioinfo work is already done in Rust.
What's "alignment" in your context. In bioimaging it usually refers to aligning something to a reference atlas (like the Allen Reference Mouse Brain Atlas) or aligning two microscope channels (like the red channel and green channel)
Having written a lot of Mojo over the last two year, just for fun, it's a really cool language. Ownership model adjacent to Rust, comptime that is more powerful than Zig, Rich type system, first class SIMD support, etc.
Performance wise it's the first language in long time that isn't just an LLVM wrapper. LLVM is still involved, but they are using it differently than say, Rust or Zig.
Very excited for Mojo once it's open sourced later this year.
Not OP, but see the entire section on metaprogramming: https://mojolang.org/nightly/docs/manual/metaprogramming/. Mojo's compile-time programming is influenced by Zig, but has features that are not in Zig e.g traits, generics (real generics), and constraints, that work together.
That's fair, I think I should have just said "comparable to Zig". The type'd ness is what I was thinking of, but having actually written some zig in the last few days to play with their Io model / see what passing around an allocator is like, Zig is pretty fantastic.
I still prefer the structure in Mojo, but boy do I miss if/switch as expressions.
https://x.com/thestanduppod/status/2091511392717213707?s=20