3 ms·
My notion of supercompilation is just the evaluating of expressions at compile time that do not depend on things at run time. A trivial case that most compiler
by seles 15y ago
My notion of supercompilation is just the evaluating of expressions at compile time that do not depend on things at run time.
A trivial case that most compilers do is converting print 1+1 to print 2. Since 1+1 does not depend on anything that could happen at run time and does not produce any other side effects. (You need to analyze that + hasn't been overloaded to have side effects/etc.).
The idea is that many of the expressions being passed into eval could be calculated in entirety at compile time, so there is no need to have eval in the compiled result at all. Just evaluate at compile time, remove the eval and the quotes.
I am not talking about trying to optimize eval, if you have a variable string going in, you can't possibly do that. I guess I shouldn't have used the term supercompiling, it may mean something more powerful than in the cases I'd seen it and I was probably trying too hard to use a buzzword...
- takeoutweight 15y agoThe term that describes what you are referring to is 'partial evaluation'