Open
Description
Right now, the @memoize
macro creates the cache dictionary using eval
:
Lines 49 to 52 in 1709785
This is generally considered a bad idea in macros, and until recently, also caused an error here because the code was
eval
ing into the Memoize package (see #32).
Right now, using eval
gives the following behavior:
- all memoized methods of a given function share the memoization cache
- if a method is overwritten, the cache is cleared, and any other global resources created/held by the previous version of that method are released:
Lines 257 to 266 in 1709785
I made one attempt to simply use a different cache dictionary for each method of a given function (JuliaCollections:1709785...JuliaCollections:a9170e5). This mostly works, but as-is causes the test above to fail, because the old cache is not released when the method is overwritten.
There may be an easy way around this, but it's not obvious to me right now.
Thoughts and/or pull requests welcome!
Cc: @cstjean
Activity