5 ms·
I don't buy the mojo hype. The concept of compiling python has been tried again and again. It has its moments, but anything remotely important is glued in from
by KeplerBoy 3y ago
I don't buy the mojo hype.
The concept of compiling python has been tried again and again. It has its moments, but anything remotely important is glued in from compiled code anyways.
- ptx 3y agoFrom a quick reading of the Mojo website, it sounds like gluing in compiled code is exactly what they're doing, except this time the separate compiled language happens to look sort of like Python a bit. For the actual Python code it still uses CPython, so that part doesn't get any faster.
- morelisp 3y agoPyrex, Cython, mypyc, Codon... we've been down this road before plenty too. If Mojo succeeds it will be purely based on quality of implementation, not a spark of genius.
- pdpi 3y agoThe "spark of genius" might very well be a novel implementation strategy.
- neolefty 3y agoIt leverages the Multi-Level Intermediate Representation (MLIR) https://mlir.llvm.org/ https://mlir.llvm.org/ which is a follow-on from LLVM, with lots of lessons learned: https://www.hpcwire.com/2021/12/27/lessons-from-llvm-an-sc21-fireside-chat-with-chris-lattner/ https://www.hpcwire.com/2021/12/27/lessons-from-llvm-an-sc21...
- morelisp 3y agoAgain, "compile to an IR" isn't exactly ground-breaking. The devil will be in the details.
- deleted 3y ago[deleted]
- sfpotter 3y agoCython works and is widely used. Problem is that there aren't too many people working on it (from what I can tell), so the language has some very rough edges. It seems like it has mostly filled the niche of "making good wrappers of C, C++, and Fortran libraries". Cython has always been advertised as a potential alternative to writing straight Python, and there are probably a decent number of people who do this. I work in computational science and don't personally know anyone that does. I use it myself, but it's usually a big lift because of the rough edges of the language and the sparse and low quality documentation. If Cython had 10x as many people working on it, it could be turned into something significantly more useful. I imagine there's a smarter way of approaching the problem these days rather than compiling to C. I hope the Mojo guys pull off "modern and actually good Cython"!
- morelisp 3y agoCython was, of course, "modern and actually good Pyrex." In the end the way the industry works guarantees a endless stream of these before some combination of boredom and rentiership result in each getting abandoned. It's just a question of whether Mojo lasts 1, 3, or god willing 5 years on top.
- sfpotter 3y agoIs it the way the industry works, or is the way open source works? Pyrex had basically one person behind it (again, from what I can tell), and Cython currently has ~1 major person behind it. Not enough manpower to support such large endeavors. Ideally, government or industry would get behind these projects and back them up. Evidently Microsoft is doing that for Python. For whatever reason, Cython and Pyrex both failed to attract that kind of attention. Hopefully it will be different with Mojo. Here's to 5 years!
- KeplerBoy 3y agoThere's also Numba, which seems a lot more active and compiles directly to LLVM IR.
- microtonal 3y agoWe use Cython a lot. Currently two biggest annoyances are the lack of tooling, in particular a language server and code formatter. Besides that, even though Cython looks a lot like Python, you need to have some familiarity with C or C++ to avoid shooting yourself in the foot and to check that the generated code is not suboptimal. Cython's main benefit is very deep integration with Python (compared to eg. Rust and PyO3).
- posco 3y agoGreat implementation is genius.
- morelisp 3y agoBut grueling and desperately dependent on broader trends. I wouldn't want to bet on "lots of work for a chance to get incrementally better."
- grumpyprole 3y agoMojo compiles "Python" to heterogeneous hardware, I don't believe that has been tried before.
- KeplerBoy 3y agoIt has. There's Numba, CuPy, Jax and torch.compile. Arguably they are more like DSLs, which happen to integrate into Python than regular Python Of course I don't know what Mojo will actually bring to the table since their documentation doesn't mention anything GPU specific, but the idea isn't completely novel.
- pjmlp 3y agoIt has mostly failed, because contrary to the other dynamic languages, back to the early Lisp compilers, there is a community resistance to JIT adoption and most relevant refactoring C API on CPython. In no way is Python more dynamic than Smalltalk, SELF or Common Lisp, which can at any given time redefine any object across the whole execution image and were/are mostly bootstraped environments.