medikoo / memoizee

Complete memoize/cache solution for JavaScript
ISC License
1.73k stars 61 forks source link

Error: Circular invocation #58

Closed maxnowack closed 8 years ago

maxnowack commented 8 years ago

Sometimes I'm getting Circular invocation exceptions. What exactly does this mean and how can I fix it?

medikoo commented 8 years ago

It means that for same arguments you call function recursively, and that can't work with memoization.

So e.g. you call memoized function with 6 and then internals of that function call again self function with 6. With deterministic function (and that should be the case for memoization) it will produce infinite recursion, hence early error