2 ms·
> what if something else is using that object and we're mutating it? You're probably aware that in Rust we have other, better safeguards against that, and you
by kragen 5y ago
> what if something else is using that object and we're mutating it?
You're probably aware that in Rust we have other, better safeguards against that, and you were probably talking about languages like Java and C++ where you don't, but I thought I'd mention it in case someone reading the thread doesn't know that.
- asimpletune 5y agoYeah totally, I just meant as a pattern. Nonetheless, in rust even though you may have the borrow checker to safeguard against the mistake, that still leaves you with now needing to accomplish the thing, in spite of the borrow checker. Which is where using a builder would be one way to do it. So even rust you still need *something*, it’s just safer and more obvious to see why, because you literally can’t share the reference in two places.