2 ms·
I would point out that by "it would be easy to leak memory with that", in reality almost every run time that has ever implemented this "optimization" to automat
by jerf 8y ago
I would point out that by "it would be easy to leak memory with that", in reality almost every run time that has ever implemented this "optimization" to automatically apply has had to either pull it back out, or make it explicit whether or not you're taking a copy of the underlying string. I've seen it at least three times. The probability of a given program having this problem is lowish (not that low, but reasonably low), but the probability of one of a language community's flagship projects having this problem shoots to 100% almost instantly for any non-trivial language or community.
- srean 8y agoI like it how Guile does it. There it is very explicit whether you are getting a copy or a view.