RCR 339: Partial Evaluation
Submitted by cyent (Tue Jun 13 04:50:19 UTC 2006)
Abstract
Given how dynamic ruby evaluation is already, I suspect it may not too huge a leap to do Partial Evaluation.
Whilst PE is interesting from the optimization point of view, there are many other very interesting applications, especially when your object types are also first class constant objects.
Problem
Rather than a problem, I would describe this as a solution to many problems. We already have a strong notion of contant, literal and non-constant in ruby.
We already have pretty dynamic and context sensitive evaluation.
How much bigger leap would it be to do full partial evaluation?
Proposal
The interesting feature about this is there is no change to existing syntax or semantics. At "eval" time every "constant" expression should get evaluated.
Every conditional statement that has a constant expression should be replaced by the appropriate unconditional jump.
Analysis
Clearly this an evaluator change. It also permits some really nifty further RCR's....
For example, if this RCR is accepted, the very next RCR will be "Make Ruby do Lazy Evaluation by Default".
Why? PE will permit efficient implementation of lazy evaluation and lazy evaluation permits a wide range of very expressive and powerful simplifications.
Implementation
I don't know enough about the insides of the Ruby implementation to estimate how difficult this would be.
At least propsals should be more concrete. You have to describe how it looks, and how it works, for others who aren't familiar with PE.
-matz.
|
| Strongly opposed |
0 |
| Opposed |
0 |
| Neutral |
0 |
| In favor |
0 |
| Strongly advocate |
0 |
|
RCRchive copyright © David Alan Black, 2003-2005.
Powered by .
-matz.