I think I get what you mean and I should have been more precise in my wording. I didn't mean that an alien language that looks nothing like we have ever seen but for the sake of doing it "right" from scratch would have been a good idea. A new programming language definitely should steal the ideas of other languages that turned out to be good. But Mojo also adopted some of the arguably bad ideas from Python just because there was too much design pressure to appeal to Python programmers. I wonder what Mojo could have looked like without this particular pressure. Basically, with what kind of programming language would a person with as much experience and good taste as Chris Lattner come up with if there were no such external pressures?
> what kind of programming language would a person with as much experience and good taste as Chris Lattner come up with if there were no such external pressures?
That's what the Chris Lattner from back then came up with. I doubt that early Swift is what he would repeat exactly as it was when he would get the chance to do it these days. And current Swift definitely is far away from what he would do, I think he has been quite outspoken about that. So maybe I should make my question more precise and ask what kind of programming language Chris Lattner would come up with in 2026, having learned from all the mistakes that C++, Swift, Mojo (and many others) did?
The "else" after a for-loop that executes only when the loop completely finished without a "break" or "return". While maybe a nice concept in general, using "else" for this is only to look familiar to Python programmers. The "else" word itself is really counter intuitive here in my opinion. For more, see https://mojolang.org/docs/manual/control-flow/#for-loop-cont...
Then there's "foo if cond else bar" which is Python's kind of ternary operator and it's at least slightly contentious. One could argue if a language even needs such a construct, but at least for me, I have an easier time reading the control flow when I look at "cond ? foo : bar". It gets even worse when you nest that stuff, although that's something you shouldn't do anyway. For more, see https://mojolang.org/docs/manual/control-flow/#conditional-e...
Also, indentation based syntax... well, it's a choice. I don't know if Lattner would have chose that in a language that he would have designed to his liking from scratch. For more, see https://mojolang.org/docs/reference/compound-statements/
Then there is some scoping related badness from Python that I think is really awful. In Python and Mojo (with a caveat) you can do this:
if cond:
foo = 42
print(foo)
So the scope of a variable is function-level and Mojo adopted this and called it implicitly-declared variables (https://mojolang.org/docs/manual/variables/#implicitly-decla...) as opposed to the concept of explicitly-declared variables (https://mojolang.org/docs/manual/variables/#implicitly-decla...) they added on top which uses the "var" keyword and forces block-level scoping which I'd argue is the sane default. But no, to appease Python programmers, they have this awful function-level scoping by default and you have to opt into block-level scoping by adding a "var" in front of your variable declaration.
But earlier, I was talking about a caveat in Mojo, so it's slightly less awful, because the compiler would complain in the code example above that "foo" might be uninitialized when getting to the print statement, so that's at least something nice, where the static type system prevents stupid mistakes that function-level scoping makes possible. To be fair, all the serious type checkers for Python would catch this as well.
But I hope you get the idea. Those are things I highly doubt would have made it into the language if Lattner could have designed it to his liking from scratch.
Else on for loops is truly terrible yea. I don't understand why Python STILL hasn't come up with alternate syntax and a deprecation path.
I think the trinary op in Python is way superior to Cs, and I came to Python from C.
The variable that was never declared when you hit is bad too yea, but I don't think block level scoping is any good. Pythons rule of having just two scopes (mostly) is imo the sane thing to do. Every single block adding a scope is just chaos, and C++ really screws this up with implicit this.