I think this is fixable. An invocation (f expr1 expr2) will produce the same result as the last time you invoked it if:
The body of f is the same as last time.
Every function it calls, including transitively, has the same source code as the last time you called f. Also every macro and type definition that is used transitively. Basically any code that it depends on in any way.
Every function involved is pure (no state, no IO).
Every function involved is top-level. I’m not sure this will play well with higher-order functions.
The invocations expr1 and expr2 also obey this checklist.
I’m not sure this list is exhaustive, but it should be do-able in principle. If I look at a function invocation and all the code it transitively depends on (say it’s 50% of the codebase), and I know that that 50% of the codebase hasn’t changed since last time you ran the program, and I see that that 50% of the codebase is pure, and I trust you that the other 50% of the codebase doesn’t muck with it (as it very well could with e.g. macros), then that function invocation should produce the same result as last time.
This is tricky enough that it might need language level support to be practical. I’m glad that Isusr is thinking of it as “writing a compiler”.
I think this is fixable. An invocation
(f expr1 expr2)
will produce the same result as the last time you invoked it if:The body of
f
is the same as last time.Every function it calls, including transitively, has the same source code as the last time you called
f
. Also every macro and type definition that is used transitively. Basically any code that it depends on in any way.Every function involved is pure (no state, no IO).
Every function involved is top-level. I’m not sure this will play well with higher-order functions.
The invocations
expr1
andexpr2
also obey this checklist.I’m not sure this list is exhaustive, but it should be do-able in principle. If I look at a function invocation and all the code it transitively depends on (say it’s 50% of the codebase), and I know that that 50% of the codebase hasn’t changed since last time you ran the program, and I see that that 50% of the codebase is pure, and I trust you that the other 50% of the codebase doesn’t muck with it (as it very well could with e.g. macros), then that function invocation should produce the same result as last time.
This is tricky enough that it might need language level support to be practical. I’m glad that Isusr is thinking of it as “writing a compiler”.