by afranchuk · 4y ago · 0 comments
Of course one place I don't cache is in function application because the language is not pure (so we want side effects to occur again), but this makes me think it might be really good to derive which functions/subexpressions are pure and allow the cache to be retained through function calls for those.
I'm gonna keep a close watch on this. I should probably read more white papers :)
Sounds similar to the evaluation model of the Nix expression language (the pure functional programming language used by the Nix package manager). It caches evaluation results, which (a) avoids re-computing identical expressions, and (b) allows some infinite loops to be detected.
See https://www.researchgate.net/publication/222827743_Maximal_L...