summaryrefslogtreecommitdiff
path: root/.travis.yml
diff options
context:
space:
mode:
authorMarc Siegel <marc.siegel@timgroup.com>2015-01-30 23:22:24 -0500
committerMarc Siegel <marc.siegel@timgroup.com>2015-02-20 14:32:43 -0500
commitef8f103b9c8eb3684ddef5aa42a7eb701d29acbe (patch)
treeee0f92c0eeb4b84c6e40b1df9e6a5b1a76818143 /.travis.yml
parent178e8df9b6a91375a6162721a0cbc2d90bcc7451 (diff)
downloadscala-ef8f103b9c8eb3684ddef5aa42a7eb701d29acbe.tar.gz
scala-ef8f103b9c8eb3684ddef5aa42a7eb701d29acbe.tar.bz2
scala-ef8f103b9c8eb3684ddef5aa42a7eb701d29acbe.zip
SI-8990 Allow GC during lazy evaluation of Stream#withFilter
- The fact that StreamWithFilter was an inner class prevented collection of the head during processing after #withFilter, due to the reference to the outer class instance held in self. - By implementing StreamWithFilter outside of the Stream class, we gain control of the reference to the original Stream. - We clarify explicit "filter after first use" semantics for the reference to the original stream, which allows it to be GC'd during the processing of foreach, map, and flatMap. - Code is more DRY by implementing in terms of Stream#filter, which is already correctly lazy, and then Stream's #map, #flatMap, and #foreach, which already correctly allow GC. - Unfortunately, the type returned by Stream#withFilter *must* change, as it had previously inherited from the inner class TraversableLike#WithFilter, which is where the problematic reference to the outer class instance was held. Therefore, this change is targetted to 2.12.x. There doesn't appear to be any way to fix this without changing the type, sadly. - Special thanks to @paulp who suggested the likely cause of the issue at nescala 2015, and got me setup to build and run tests. Also thanks to @Ichoran and @retronym, who suggested that filter-after-first-use would preserve the reusable nature of the return value from #withFilter, rather than a single-shot null-after-first-use solution. Review by @Ichoran and @retronym Fixes #8990
Diffstat (limited to '.travis.yml')
0 files changed, 0 insertions, 0 deletions