3 ms·
I don't see that big a deal. In a language, say Ada, I would pass in an "IN" parameter, which cannot be altered in a procedure (and by default in a function). I
by i_feel_great 8y ago
I don't see that big a deal. In a language, say Ada, I would pass in an "IN" parameter, which cannot be altered in a procedure (and by default in a function). In other languages I would keep the scope/lifetime extremely small, and just not mutate or leak memory. This is just plain ol' good programming practice IMHO.
Is there another more compelling use case. In concurrent applications perhaps?
- oconnor663 8y agoYes, being able to pass ownership of a Vec to another thread is important, because otherwise the two threads have to coordinate over when to call its destructor.