It is not a “good recommendation” in the sense that it’s good practice, it’s a recommendation in the sense that the primary goal is to get the code to compile and work. Once that is done, beginners can focus on performance optimizations. You may view it differently, but I know for a fact (from my teaching activities) that beginners are easily confused that mutating shared data (pointers, references) indeed mutates shared data and not just the perceived separate instance. Cloning gives you a new object to handle as you see fit to start out with, matching this early mental model. From there, you can build a mental model of sharing.
Strictly better? Some frameworks (I think .NET nowadays?) even mix the two, trying to leverage each technique’s strengths when they’re expected to apply. When it was about Mojo’s return behaviour, atomic counters were still lightweight, now suddenly in Rust they should be replaced for inefficiency.
Also, you previously critiqued Rust waits till the end of the scope to drop objects, while Mojo did so immediately via dataflow analysis. That’s basically “maximum ARC” semantics. Now you claim a generational GC, which inherently and intentionally delays deallocations (which has advantages!), is strictly better?
Yes, I’m not saying that’s a wrong goal, I’m saying you’re not very successful at accomplishing that goal. Moving goal posts from post to post and comparing arbitrary things (explicit clone is not the same as implicit copy/move behaviour) is not going to convince anyone of anything. If you believe the community communication around cloning is wrong, that’s a separate issue and unrelated to the language.
So you should be in favour of the Rust variant with lifetimes and critique Mojo for defaulting to refcounts.
I have no idea what this is supposed to mean. RefCell is borrow checking at runtime and that’s done for the same reasons it’s done at compile time. “Simply” using UnsafeCell or raw pointers requires you to manually uphold the safety invariants, which are otherwise safely abstracted by RefCell. What is that API supposed to do? If you want to simply “re-export” unsafe (UnsafeCell, pointers) as safe (references, slices) types, that’s obviously unsound.
Mojo can trivially support them because it does not work the way you initially claimed it did. I said that if it did work the way you initially claimed (and which you also deemed superior), that would make supporting these things nontrivial.