Partial Evaluation

A technique where the compiler evaluates or approximates some subexpressions at compile-time.


This can be used for optimization or TypeInference.

In the general case, PartialEvaluation must not occur where SideEffects are among the intended consequences of computation, for having the SideEffect at compile-time is very distinct from having it at RunTime.

However, if PartialEvaluation is performed in response to some explicit language construct (e.g. RealMacros or a KeyWord?) this is less of an issue because the programmer can then control which side-effects occur at CompileTime and which at run time.

If SideEffects are allowed, then PartialEvaluation also opens a door to CompileTimeResolution, which is powerful in its own right.

If PartialEvaluation is guaranteed by the language standard, it becomes more than just an optimization as it allows programmers to pragmatically leverage it for various forms of advanced MetaProgramming.

If guaranteed, it is a potential among KeyLanguageFeatures.


See Also:

CategoryOptimization


EditText of this page (last edited September 18, 2014) or FindPage with title or text search