The issue manifests when you’re writing code that needs to be portable across platforms. For example, maybe you’re trying to write code that runs on both on a 64-bit CPU and a funky AI accelerator where each core has a 32-bit address space. I would anticipate that most of the Go community is writing code that runs on 64-bit CPUs. In such a world, the fact that int has a platform-dependent size wouldn’t be the source of many bugs, because int is “de facto” 64 bits.
I was responding to your website example, but if you’re writing code where such portability across platform bitwidth is important, then you would take care to factor platform portability into your code rather than depending on whatever default we go with here. In my experience, no solution ever covers 100% of every use case.
Or, we can make the default indexing type one that properly handles platform differences, and you only use that type for indexing things or storing the size of things instead of as a general purpose type.
This is not a great argument IMO. If we were to apply that argument to C++, we’d be saying “C++ isn’t at fault; you just need to be more responsible with it”. Most people would disagree with that sentiment.
C++ is a mess, and most of its problems come from bad design and its C roots. Plenty of newer languages have tried to fix things, but none have caught on as a real replacement—not even Java, which has a different purpose entirely. The industry just keeps pouring money into C++ to make it better without giving up any of its control. In fact, my impression of C++ is that the responsibility and flexibility it gives to programmers is the only reason many continue to tolerate the language.
The most common reason I’ve heard for still using C++ is “because we have no other option”. Mojo should try to be that option for as many cases as possible. Rust missed a few important things that some developers really, really need, so they’re still stuck on C++. The piles of heavily optimized SIMD libraries are another reason, but in Mojo every library can be an optimized SIMD library.
As a language designer you have a responsibility to help your users build bug-free applications, because software bugs have a signficant economic cost. I’m not satisfied with telling programmers to “be more responsible”, I want to help them succeed.
As a language designer, you have no such responsibility; any pursuit in that direction is likely to result in a convoluted mess that nobody is going to use for any real-world project. It is impossible to write bug-free code in any reasonable scale, and most bugs result from logic rather than any inherent flaw in a language.
Rust seems to see a decent amount of use in such niche and academic projects as the Windows Kernel, Linux, Android, Chromium, and Firefox, and Epic Games is in the middle of building tons of stuff on top of Verse, which makes it impossible to have a lot of kinds of distributed system errors, for making multiplayer user-created content run well. Systems languages are, in my opinion, more bound to this than normal languages because systems languages don’t get to ignore that code can kill people, destroy their lives, or destroy companies.
Yes logic bugs are many of the bugs and they are nearly impossible to prevent. However, there’s a reason that Tony Hoare calls null, “His Trillion Dollar Mistake”, it added a hidden extra state to every value in so many languages, which developers would frequently forget to check, and he estimates the damage caused by his decision to add a nice little feature because it was convenient to add is at least one trillion USD. How much do you think forgetting to lock mutexes have cost humanity? Race conditions between threads? Implicit integer casts? Array to pointer decay?
Designing a programming language means that any decision you make can have a very wide reaching impact if the language is successful, and since we have the knowledge of how to prevent bugs, I think it’s irresponsible to not use it.
First, there is no way for Python to achieve Guido’s initial goal of being a glue scripting language without the dynamism; language semantics should fall out of the goals it is trying to achieve more than anything else.
Sure there is, use HM or another type inference algorithm. Luma doesn’t even need you to specify struct fields for type safety.
Secondly, I have not seen a useful language that does not allow programmers to shoot themselves in the foot, and my list includes Rust. You could say that Rust shifted the paradigm by making it obvious and explicit where exactly you can potentially shoot yourself, but control and flexibility are non-negotiables in certain kinds of applications.
Yes, they are non-negotiable. The goal is to make the control and flexibility as safe as you can make it, so that you the human only have to consider a small slice of code when writing a safe abstraction. We’ve shown time and time again that a single person working on a small piece of code can produce safe low-level code if they are very careful, the problems tend to start when the second person joins the project. By allowing for safe abstractions, we can make APIs which are impossible to use in an unsafe manner and reduce the amount of code in the “danger zone”. Mojo, with its more advanced type system, can make smaller or eliminate some of those regions.
I have to say that I don’t understand some of the responses to my comment. Nobody is arguing against safety, soundness, and correctness. However, my experience using Go, where int is pervasive, is that it is fine in the vast majority of places.
Go also has lots of “this value must be >= 0” doc comments you have to read. Those can and should be encoded in the type system.
Secondly, I don’t understand the argument against giving programmers responsibility - how is this an argument? compilers can help in some things, but users have to take responsibility to understand how the systems they’re programming work. This is not controversial.
Software developers have, as a group, proven that they can’t handle the responsibility, especially at the scale of modern programs. Systems-level developers or otherwise.