News for hackers. Stuff that matters.
Re:Strings Are Evil by jerf on Wednesday June 20, 2018 @03:39PM (#17358972)
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.
Re:Strings Are Evil by srean on Thursday June 21, 2018 @12:46AM (#17362237)
I like it how Guile does it. There it is very explicit whether you are getting a copy or a view.