Closed fps closed 1 year ago
Hmmm, OK, yeah, I was naive...
using Memoization
@memoize function f(x); sleep(2); x; end
f(1) # sleeps
@memoize function f(x); sleep(2); x; end
f(1) # sleeps again
which is not _really_surprising since the function is redefined.. Which is what happens when I reinclude my code snippets..
Thanks! And thats right, whenever you redefine a memoized function, the cache for all methods of that function are cleared to be safe to make sure you never get the wrong answer. This could be improved to be smarter and only clear the cache when its really needed. If this is something you really need, feel free to open an issue, its something I could look into.
Hi,
I am playing around with this package since it would be nice to memoize some things, but it seems it's not working for my particular case.. Here is one file:
test_memoization.jl:
This works fine if used from the REPL,
But now if I add a second file into the mix, test_memoization2.jl:
Then this happens:
Is my use of
include
too naive? Will I have to switch to a more "usual" project structure? Using modules, etc?Kind regards and thanks for providing this package :)