coconut
coconut copied to clipboard
Change default `memoize` implementation
Currently, memoize by default allows the cache to grow without bound, which isn't great as it can lead to memory leaks, but is nice for making sure recursive functions always work well. An alternative compromise implementation could be to allow the cache to grow without bound, but always clear the cache after the end of the first call to the function highest up in the stack. Making this the default would be a breaking change that would need to be done on a major version increment, but we could just make it optional to start with.
Implemented but not currently set as default; that should only be done with a warning once we hit Coconut v4.