The Caching/Memoization section talks about pure functions.
Can we link to pure function definition?
Isn't it already explained?
The provider function must be a pure function, that is, for the same key it must always yield the same result.
I mean it is more than that.
Quoted wiki:
In computer programming, a pure function is a function that has the following properties:
- Its return value is the same for the same arguments (no variation with local static variables, non-local variables, mutable reference arguments or input streams from I/O devices).
- Its evaluation has no side effects (no mutation of local static variables, non-local variables, mutable reference arguments or I/O streams).
So I think it is a good idea to define exactly pure function in our cases.
jyn514 in https://github.com/rust-lang/rustc-dev-guide/pull/1001#issuecomment-753702663
@lzutao I think it's unlikely anyone will know what changes you wanted other than you. Are you interested in making a PR with the information you were talking about?
Maybe I was too picky about definition of "pure function" in caching implementation of rustc.
If Caching/Memoization of rustc may have side effects (mutation of local static variables, non-local variables, mutable reference arguments or I/O streams), the current explanation in #1001 is good enough.
Closing as such.
Most helpful comment
Isn't it already explained?