3 ms·
Yeah, the use requirement is annoying. It would really be nice if there were a way to make that check optional. As far as closures capturing references-- if c
by cmccabe 14y ago
Yeah, the use requirement is annoying. It would really be nice if there were a way to make that check optional.
As far as closures capturing references-- if closures captured by value rather than by reference, how would maps and slices be handled? Anywhere the closure used one of those items, it would have to be deep-copied-- a potentially slow operation. Even deep-copying structures could get expensive. The worst part would be that this cost would be hidden to the programmer, who would wonder why his code got so slow all the sudden. I think having them capture references is the only reasonable design given the other design choices.
- akkartik 14y agoCopy on write, maybe?