Iâm hopeful that the error message would tell them that they should think about casting their number to isize, or whatever, which may be smaller. At which point, they should think about that. I might be wrong, but my experience with Rust hasnât been âstart with easy but ill-defined stuff, and opt in to more detailâ. Theyâre going to hit borrows and lifetimes five minutes later; this specificity might be a good warm up (or filter; shame on me for typing that, but if the programmer decides they canât be bothered, Rust might not be for them).
In my fantasy world, most of these cases (comparisons with .len(), indexing, etc) would be taken care of by enriching comparisons and indexing (is something wrong with defining u32 to u64 comparison? I donât know). I donât write types very often when I donât care (inference sorts out what I need, and would likely hand me an isize). This is sort of what I was getting at with the iunk vs isize thought experiment: I canât think when I would write down iunk in a struct or function definition; I always seem to know what I plan to use it for, and write the appropriate type down.
If the question is (I sense): âwhat should the first experience be?â rather than âcâmon, we all like int, right?â you could think of having int in the language, bound to i32/i64 or whatever, but triggering a lint that says âok, time to put on your grown-up pantsâ / âportability warningâ.
I think the arguments that performance sensitive folks will write lots of int everywhere and then be confused is misguided. I can see the issues coming up, but it will be like explaining -O or --release, admittedly with more editing in their future. This is probably annoying for them, but way less so than âI ported my C++ OOP architecture to Rust, but now have all these borrow check errorsâ.