I was imagining a language which would super-optimize only for specific inputs. As an example, let's say you have a program which solves a Project Euler problem. The first time you run it, it takes a while. But the next time you run it, the result is "memoized" (on disk maybe, or embedded into the source code as a constant) and the program returns the value instantly.
This is similar to compile-time function execution, but there's a tradeoff. With compile-time execution, you only have to compile and run once, which is nice. But you also lose some flexibility, because you can't optimize for any values that are provided at run-time.
You can optimize in some cases, even when you don't know what the input would be.
A great example is the one from the post where `morte` optimizes the function `#and #True` to the identity function on `#Bool`s even though it doesn't yet know what the second argument would be.
I was imagining a language which would super-optimize only for specific inputs. As an example, let's say you have a program which solves a Project Euler problem. The first time you run it, it takes a while. But the next time you run it, the result is "memoized" (on disk maybe, or embedded into the source code as a constant) and the program returns the value instantly.
This is similar to compile-time function execution, but there's a tradeoff. With compile-time execution, you only have to compile and run once, which is nice. But you also lose some flexibility, because you can't optimize for any values that are provided at run-time.