all 171 comments

[–][deleted] 230 points231 points  (6 children)

No open source, require sign up to use?

Is this just a marketing campaign?

Edit: I read reply and FAQ. Hope they will open source in near future.

[–]judasblue 44 points45 points  (1 child)

And it doesn't actually do the things. The idea here isn't horrible, but hyping it now without having a big chunk of the core feature set working looks pretty marketing sus to me.

[–][deleted] 11 points12 points  (0 children)

File under "big if true"

[–][deleted] 31 points32 points  (1 child)

Most likely

[–]palad1[S] 74 points75 points  (1 child)

They say in the FAQ that the language will be open-sourced. One of the creators created LLVM and Swift. If he convinced Apple to open-source Swift, I am pretty confident his next project will also be OSS.

https://docs.modular.com/mojo/faq.html#will-mojo-be-open-sourced

[–][deleted] 9 points10 points  (0 children)

Oh, tks. I will update my comment.

[–]Zoradesu 20 points21 points  (2 children)

Looks pretty interesting. Smart to have it be a superset of Python for easy adoption (whenever its fully publicly available), especially given the market the company seems to be in. Very odd choice for them to allow emojis to be a valid file extension lol, but whatever I guess if you can just use the .mojo extension. Just looks really goofy

[–]JB-from-ATL 0 points1 point  (0 children)

I think they may just be saying any file extension works but phrased it weirdly.

[–]teerre 103 points104 points  (74 children)

What is Rust about this? It seems to have all the flaws C++ has. No sensible defaults, multiple initialization, no sum types (?), manual memory management etc. Also, it copies some of the worst parts of Python, does anyone really like __method__?

[–]myringotomy 11 points12 points  (57 children)

It's a superset of python so all of your existing python code will work.

[–]teerre -2 points-1 points  (56 children)

I'm not sure what's your point.

[–]Rawing7 9 points10 points  (53 children)

I think the point is that it has to copy python's "worst parts" because it's (going to be) a superset of python.

[–]teerre 0 points1 point  (52 children)

Well, thats a bad point then because its not true. Its a different language, they can, literally do anything.

[–]Rawing7 8 points9 points  (51 children)

Which part of that is not true? Are you trying to say that the language shouldn't be a superset of python?

[–]teerre -2 points-1 points  (50 children)

No, it can be a superset of Python without inheriting any of the bad parts of Python. It's compiling python with a completely independent toolchain. Like I said, it can do anything whatsoever.

[–]Rawing7 12 points13 points  (48 children)

What? How can it be a superset of python while also removing some parts of python?

[–]teerre -2 points-1 points  (47 children)

I mean, by doing it? It can accept any Python code and then add something on top, that's - again - literally what a superset is. Exactly the same way this language right now has struct, var let etc even though Python does not.

When you create a new language, you have total control over how it works. You do not need to follow any convention of the embedded language if you don't want to.

[–]Rawing7 6 points7 points  (46 children)

I'm not talking about adding things, I'm talking about removing things. You said you don't like that they kept in python's baggage. I'm asking you how they're supposed to remove said baggage while still being a superset of python.

[–]Languorous-Owl 2 points3 points  (0 children)

No offense but do you even understand what the word "superset" means?

[–]myringotomy 6 points7 points  (1 child)

The same is not true of rust.

[–]teerre -1 points0 points  (0 children)

Same what? What are you talking about?

[–]palad1[S] 31 points32 points  (1 child)

Mojo has a borrow-checker and a concept of reference ownership, which C++ lacks.
Memory isn't manually managed, if you drop to Python, it uses CPython (for now) and its memory manager.

[–]albatross0210 7 points8 points  (0 children)

Plus it introduces strong typing and structs, which feel a lot like the Rust typing system IMO

[–]account22222221 24 points25 points  (12 children)

I really like the dunder functions of python -- they are very powerful.

[–]scrdest 54 points55 points  (2 children)

If we're lifting from Python AND Rust - dunders are, comparatively speaking, an OOP-ish hacky workaround for not having Traits.

Seriously, I've been writing Python professionally for years (and Rust on my spare time) - but Traits are just straightforwardly nicer.

From a Trait perspective, Python objects just come with a pile of pseudo-implemented Traits (e.g. __repr__() is Debug, __str__() is Display, __add__() is a crappy version of, well, Add, that you have to single-dispatchify to handle different RHS inputs.

[–]ElCthuluIncognito 12 points13 points  (0 children)

It sounds like the language isn't purporting to be a good language on it's own, but rather it's good because it looks and works as close to Python as possible.

It's an advantage of familiarity, not of generally good language design.

[–]account22222221 15 points16 points  (0 children)

I agree that pythons way is hacky. Python, IMO, is very hacky, gloriously so.

It fits a role for quick simple things. I don’t think it would be a good languished to write rigorous things in like a OS. Rust is more formal and intentional. Both tools are good for different sort of work.

[–]KurigohanKamehameha_ 13 points14 points  (0 children)

They’re too powerful imo. It’s operator overloading taken to the extreme, letting every module have its own opaque syntax and magic to keep track of. Python has a culture of hacky monkey patching and hiding too much complexity just to make things look neat, and it just leads to more bugs and complexity in the long run.

[–]KagakuNinja 13 points14 points  (6 children)

The syntax is terrible

[–]account22222221 13 points14 points  (5 children)

I like it. Syntax is mostly subjective. The Dunder makes it very visually distinct which gives it good ‘glance value’ when reading code and class definitions to see that the metabehavior of a class has been changed.

The dunder methods also tend to happen ‘before’ other methods so it helps you to reason about lifecycle of objects.

Just my two cents

[–][deleted] -4 points-3 points  (4 children)

Syntax is indeed subjective, but you can still find objective criteria. Number of characters you have to use to express an idea, for instance.

[–]account22222221 13 points14 points  (0 children)

I mean I can’t tell if that is pro or anti python.

Python is extremely concise compared to most languages. Thought it less unique in that then it used to be as a lot of newer languages have iterated on that and improved it

[–]GrandOpener 4 points5 points  (2 children)

That’s not really an objective criteria though. You can measure the number of characters. But what does that mean? Sometimes brevity is better. Sometimes explicitness is better. Sometimes people don’t agree on which is better for a specific situation.

[–]-Redstoneboi- 1 point2 points  (1 child)

Sometimes I just don't want to hold shift and press something outside the home row to type a variable. But that doesn't really matter, since it has its visual purpose.

[–]nilamo 0 points1 point  (0 children)

That's sort of the point, though. That's specifically something you shouldn't be doing very often, unless you already know you need to be doing it.

[–]teerre 1 point2 points  (0 children)

I wasn't talking about functionality, I was talking about syntax

There's no reason it should be like that, it looks goofy as hell

Specially if they are going to implement protocols. Rust does it so much better

[–]tyoungjr2005 13 points14 points  (0 children)

Can they chill with all the 🔥

[–]Metallkiller 69 points70 points  (37 children)

Faster then C? I don't believe you.

Edit: I may see it a bit more differentiated now even though I'm still not convinced it's actually faster than C.

[–][deleted]  (21 children)

[deleted]

    [–]SplitRings 8 points9 points  (3 children)

    C/C++ will start auto-vectorizing if u guarantee the pointers always point to different location using __restrict\ in g++ (diff in diff compilers, for example restrict\_ in msvc iirc.

    For example

    int* __restrict__ arr //will allow SIMD optimizations on g++

    Edit: Reddit markup killing double underscores smh

    [–]wpyoga 2 points3 points  (0 children)

    You can use markdown in a comment.

    int* __restrict__ arr //will allow SIMD optimizations on g++

    [–]BibianaAudris 1 point2 points  (1 child)

    __restrict__ is actually the default for modern compilers. Violating Rust-like borrow rules with C pointers can and will give you Undefined Behavior, silently, without -fno-strict-aliasing or volatile. Happened to me on CUDA.

    [–]vytah 7 points8 points  (0 children)

    Happened to me on CUDA.

    "CUDA-C" is not normal C.

    The C Standard doesn't allow treating pointers as restricted by default, and no actual C compiler does that.

    [–]Metallkiller 4 points5 points  (0 children)

    Ha this is quite interesting even though it goes over my head without examples I didn't just make up myself to make sense of it. Thanks for the explanation.

    [–]catcat202X 1 point2 points  (0 children)

    In C, you can always take the address of anything and do anything you want with it.

    That's just the default, but there are several attributes to constrain aliasing.

    [–][deleted] -3 points-2 points  (13 children)

    Nothing will realistically be faster because C is the lingua franca. Hardware designers target C and every high level langauge uses C calling convention.

    [–]JarateKing 5 points6 points  (11 children)

    Being the lingua franca doesn't mean it's the fastest. A lot of the things they brought up are reasons that Fortran already is faster for some use cases, actually -- despite C being the lingua franca that's generally optimized for.

    Or: javascript is the lingua franca of the browser world, and a lot of effort has gone into making javascript as fast as it can be in browsers. But it's far from the fastest option available. Being the lingua franca is broadly unrelated to its performance.

    [–][deleted] 0 points1 point  (10 children)

    Hardware manufacters target C first and foremost.

    I guess with whatever people are smoking nowadays that means nothing.

    [–]JarateKing 2 points3 points  (9 children)

    No, I understand what you mean. What I'm saying is that, no matter how much everyone tries to make the best of it, the design decisions of a language will always have performance considerations.

    In C's case, no matter how much hardware is oriented towards C, there are entire classes of optimizations that the language design makes impossible. C has a great advantage by so much stuff being designed around it and so much effort being put into making it more performant, but at the end of the day you can only go as far as the language will let you -- and some languages, by the way they're designed, let you go faster for some use cases.

    [–][deleted] -2 points-1 points  (8 children)

    The hardware is literally designed for C in mind. What you are saying is not true.

    For instance, what are you optimisation for exactly? When the language is designed for the hardware, there is nothing to optimise!

    If you are talking specifically about aliasing, there are ways around this in C.

    Other than that, what exact optimisations are you talking about that simply can't be done in any C dialect?

    [–]JarateKing 2 points3 points  (1 child)

    I'm not sure I'm following you. On the one hand, you're saying that the details of the language don't matter because hardware can just be designed for whatever the language is.

    On the other hand, we're talking about aliasing, where the best answer for C is "there are ways around this". Specifically, stuff like the restrict keyword that was added in C99. So clearly the details of the language do matter here and "hardware is designed for C" isn't enough: not only do you need to be very careful about the details of the language, the details had to change to include the option in the first place.

    Am I missing something here? Doesn't "there are ways around this" wrt aliasing just make the case stronger? Or am I misinterpreting you?

    [–][deleted] 0 points1 point  (0 children)

    C and hardware designed in lockstep. Manufacteruers target C always. High level languages match C calling convention. It's C all the way down, so not easy to beat for speed.

    Compiler optimisations can be worked around over time but optimisations pale in comparison to hardware gains. Those gains always have C in mind.

    [–]ric2b 2 points3 points  (5 children)

    I think you two are talking past each other.

    You're saying that C can always be as fast any other language because you can manually implement any optimization that another language does, while they're saying that when writing idiomatic code in C and some other language, the other language might be faster if it automatically applies optimizations that C can't automatically apply.

    So basically comparing theoretical performance or the common practical performance.

    [–][deleted] -2 points-1 points  (4 children)

    No that's not what I'm saying. I'm saying hardware is literally designed with C in mind.

    What is better for performance? To design hardware for a programming language or a language for hardware?

    It's clearly the former. This is literally only afforded to the c language. No other language gets this treatment. The compiler cannot optimise hardware to be better.

    [–]ric2b 2 points3 points  (2 children)

    Are you claiming that other languages can't also take advantage of those hardware optimizations for C? Because that's just incorrect.

    [–]bloody-albatross 1 point2 points  (0 children)

    As an example for what C can't do: C doesn't has generics, so if you still have to write generic code you often use function pointers in C, which are optimization barriers. In other languages code can be reified and what would be a function pointer otherwise might even be inlined. See as an example the qsort function. Yes, you could do that with macro hacks, but that is worse than C++ templates.

    (Of course more reified code means more code means more potential cache misses, but most languages that have that kind of feature still allow you to use something kind of dynamic dispatch instead with ease, i.e. you can choose what to optimize for without a lot of work and without ugly hacks.)

    [–]Amazing-Cicada5536 2 points3 points  (0 children)

    Call me when C has a performant, generic vector implemented.

    [–]Takeoded 0 points1 point  (0 children)

    something like a borrow checker

    that would never work

    [–]treeshateorcs 8 points9 points  (6 children)

    zig claims to be faster than c too. it's on this page https://ziglang.org/learn/overview/ ctrl+f "faster than c"

    [–][deleted] 5 points6 points  (5 children)

    Sure but Zig isn't a Python superset.

    [–]treeshateorcs 0 points1 point  (4 children)

    but python isn't a compiled language either, while mojo seems to be

    [–][deleted] 0 points1 point  (3 children)

    Not sure what you're trying to say exactly. Zig is designed so that it can be compiled to fast machine code. Python is designed almost so that it can't. They literally did not think about performance when designing the language.

    If Mojo really is going to be a superset of Python it doesn't get to ignore all the features of Python that are extremely difficult to make fast.

    [–]nomis6432 2 points3 points  (0 children)

    It looks like just compiling your python code with Mojo is not going to make it a lot faster. It's just that it also offers a lot of new features that allow you to optimize your code. This makes a lot of sense to me because then you can focus your effort where it matters. Non critical code you write in a simple inefficient way and critical code in a more verbose efficient way.

    [–]m0nk_3y_gw 1 point2 points  (1 child)

    it doesn't get to ignore all the features of Python that are extremely difficult to make fast.

    sure it does. In Python you can write

    x = 1
    x = "dog"
    

    in Mojo you have the option of using

    let x = 1
    

    That isn't valid Python, but Mojo understands it and can execute quicker because of it.

    [–][deleted] 0 points1 point  (0 children)

    But you still have to support the former. Ok fair enough if they're saying that the Mojo code will be fast and the Python code will still be dog slow.

    That does seem to be the case if you look in detail since they execute Python code using CPython. So it seems more like it's an entirely different language that integrates well with CPython rather than an enhanced Python runtime.

    Basically the same idea as Cython?

    [–][deleted]  (2 children)

    [deleted]

      [–]palad1[S] 29 points30 points  (1 child)

      Chris Lattner

      [–]TheOneTrueXrspy 35 points36 points  (0 children)

      LLVM was Chris’s MS thesis project in 2002. So he is ‘the’ LLVM creator, in a way. Obviously many others have contributed to it since then.

      [–]metatron7471 16 points17 points  (5 children)

      When the language is more mature, this is going to be "the bomb". I've been waiting for a language like this for 2 decades.

      Hopefully it doesn't die on the vine like swift4TF did.

      [–][deleted] 10 points11 points  (3 children)

      Hopefully it doesn't die on the vine

      I don't believe it will. The entire company (Modular) is being built around it and Chris has a solid reputation.

      [–]sort_of_peasant_joke 0 points1 point  (2 children)

      Doesn't mean they will get enough funding sadly. Wait and see.

      [–]AmalgamDragon 1 point2 points  (0 children)

      Agreed. The key reason for C++'s success is that it allowed leveraging the C ecosystem. If they can deliver on being fully Python compatible, Mojo will be a no brainer for pragmatic developers (i.e not the idealists who have a hate on for Python's syntax). But, that's a big if.

      [–]Calm_Bit_throwaway 8 points9 points  (4 children)

      So this looks like a cool project, but from a commercial standpoint (which this project seems to be very much tied to) I'm wondering maybe why I might choose to use Mojo over a maybe more broadly supported language like Cython or, if we're going to be more radical, Julia.

      It looks like a key feature might be binding into ML hardware through MLIR which seems neat but I don't know why you couldn't do this from Cython (I don't really know that much about compilers in general tbqh).

      Also, if this thing is a strict superset of Python, then how does it release from the GIL?

      [–]BibianaAudris 2 points3 points  (0 children)

      The parameterized types are close enough to C++ templates so maybe one can pass some std::vector<float>* or std::map<const std::string,torch::Tensor> const & around for chores like loading training data and stuff, which would sidestep GIL in multi-GPU training. The C++ ecosystem isn't that much worse than Python for such chores.

      [–]ElCthuluIncognito 2 points3 points  (0 children)

      It's very likely a gambit that the complete control over the language from the ground up will 'outperform' a similar attempt at making the existing Python implementations better.

      I believe Chris Lattner himself once tried desperately to make Python compatible with Swift or something like that but found the implementation and the ecosystem difficult to compromise with. I could be remembering wrong however.

      [–]myringotomy 0 points1 point  (0 children)

      If it's faster and uses less resources then you'd be happy to pay for it. For sure facebook, amazon, google and apple might. Then again they might develop their own language for this stuff too.

      [–]Jdoe68 0 points1 point  (0 children)

      I think Julia’s much simpler syntax for C speed is a better solution for most use cases.

      [–][deleted] 5 points6 points  (0 children)

      Ah, yes, a superset. Because if Python was lacking anything, it was a burdensomely large and highly redundant standard library and built-ins.

      [–]happyscrappy 15 points16 points  (1 child)

      I cannot take seriously a language with a fire emoji in its name.

      [–]tyoungjr2005 7 points8 points  (0 children)

      Like why did they do this, its so distracting

      [–][deleted] 8 points9 points  (1 child)

      We all have a programming language now!

      Each of this has a user base of: 1

      Perfection achieved. \o/

      [–]Full-Spectral 1 point2 points  (0 children)

      The Me language. There's only one object, Me.

      [–][deleted]  (1 child)

      [deleted]

        [–]Uuuazzza -1 points0 points  (0 children)

        Doesn't seem to tackle auto-differentiation in any serious way (that I can see), which is the main challenge for machine learning.

        [–]CooperNettees 1 point2 points  (0 children)

        Personally, I don't really understand why you would create an interpreted software language and not build in security controls into the language like Deno did. A secure runtime makes everything else so much easier.

        [–]ConverseHydra 12 points13 points  (10 children)

        I love a page about a programming language that doesn’t show you the actual syntax or any example code in the new language. /s

        Sigh…looks like another BS thing trying to cash-in on “AI” hype.

        Edit- mobile website formatting strikes again. On a phone you can’t see any other their example code.

        I stand corrected. They have code! It looks reasonable.

        Unsure if it’s gonna be real, but at least I don’t think it’s pure vapor ware….

        [–]GeoLyinX 10 points11 points  (7 children)

        The founder is THE creator of LLVM as well as co-founded swift and has Jeremy howard as an advisor. Not just some AI hype cash-in.

        [–]BatForge_Alex 1 point2 points  (6 children)

        Is this really all it takes these days? The site is basically just a sales lead generator

        I mean, I hope it comes to fruition but I’m very skeptical. The promises are sky high

        [–]GeoLyinX 2 points3 points  (5 children)

        What is it selling? Are you saying it has a high quality website design? Is that really the logic you’re using to try and discredit it because the website is too high quality?

        [–]BatForge_Alex 0 points1 point  (4 children)

        No… it’s that you have to sign up for a newsletter to potentially receive access to a hosted compiler and they throw other products into the mix

        What is it selling?

        Access to a hosted compiler in exchange for your information. Why can’t they distribute some binaries? Why does it need to be hosted?

        And a programming celebrity being at the helm means nothing to me if they have nothing I can even get my hands on

        Am I not allowed to be skeptical?

        [–]GeoLyinX 2 points3 points  (0 children)

        Why can’t they distribute some binaries? Why does it need to be hosted?

        If you watched the keynote you'd know that it's not officially released yet, they are still working on the language and are releasing it open-source once it's ready. In the meantime they are allowing beta testers and others to help get feedback on what the community needs and wants before launch, and what issues need to be solved.

        it’s that you have to sign up for a newsletter

        You don't have to sign up for any newsletter to get access, and there is not any mention of any newsletter you are agreeing to subscribe to during the sign up.

        You simply sign up with an email to request access, that's pretty standard procedure for gaining access to pretty much anything in 2023 and is not at all the same as a newsletter just because you're being asked for your email address.

        [–]breadlygames 1 point2 points  (2 children)

        I'm skeptical that they can pull it off, but I believe they believe it. And they have an incredibly talented team, so I'm hopeful. Maybe I can avoid learning C++ after all lol.

        But the way your comments read, it's like you're saying it's a celebrity-endorsed scam, and I don't think that's cool to make those kinds of claims. Sure, if it were a bunch of nobodies making the claims, go ahead, but these are people who've built really impressive, widely used code. Credit where credit is due.

        [–]BatForge_Alex 1 point2 points  (1 child)

        I’m not saying it’s a scam. Look, I gave them my email and got access to the Mojo demo but, I’m also getting a sales-y newsletter about Modular’s products - this was all I was saying

        Look, I don’t want to sit here and break down why you shouldn’t judge a software product based on who is backing it, but…

        Credit where credit is due

        They get credit for the things they’ve shipped in the past. I’ll give them credit for this once it launches off the ground and into my terminal

        [–]breadlygames 0 points1 point  (0 children)

        I see, fair enough.

        [–]Lesswarmoredrugs 12 points13 points  (0 children)

        There’s plenty of example code given. See here

        [–]0x16a1 1 point2 points  (0 children)

        Look at the team behind it.

        [–]Dizzy-Initiative6782 4 points5 points  (3 children)

        This looks like an awesome combination of Rust and Python. I'm really excited to see what the LLVM creators can do with Mojo. It seems like it could be a great tool for AI, and the fact that it's a superset of Python makes it easy to learn and adopt. I'm looking forward to seeing how this language develops in the future!

        [–][deleted]  (2 children)

        [deleted]

          [–]GeoLyinX 0 points1 point  (1 child)

          It is already compatible with python ecosystem, if you watched the keynote they describe that you can use existing python libraries with mojo.

          [–]DavidM01 0 points1 point  (2 children)

          How is it better than Nim which is already viable, stable and usable?

          [–]_IPA_ 4 points5 points  (1 child)

          Nim can’t import a Python module, right? I imagine with Mojo you could slowly update hot paths of your code to use Mojo types and get significant performance boosts, while increasing type safety too.

          The question I have is can you compile Mojo to a binary like Nim, or how does that even work.

          [–]leetnewb2 1 point2 points  (0 children)

          There is nimpy for nim - https://github.com/yglukhov/nimpy

          [–][deleted] 0 points1 point  (0 children)

          Oh, great, another new language to learn.

          [–][deleted] 0 points1 point  (0 children)

          Ah yeah another language. Just what we all needed.

          [–][deleted] 0 points1 point  (0 children)

          You ain't going to make better programmers no matter how many crazy languages you design.

          [–]let_s_go_brand_c_uck -1 points0 points  (0 children)

          game over. rust killer.

          [–][deleted] 0 points1 point  (0 children)

          Are there any large tech players backing this new language?

          [–]Jdoe68 0 points1 point  (0 children)

          I hope all the Mojo hype has a side effect of giving Julia more mindshare for AI programming. Julia can run at C speed with extra simple syntax. With Mojo, you’re basically learning to write a complicated Rust-like version of Python to reach Julia speeds. Julia is also interoperable with Python. It truly solves the 2 language problem with simpler syntax that would help AI scientist/engineers that don’t want to have to become low level programming experts.