
On 2006-06-19, Akim Demaille <akim@lrde.epita.fr> wrote:
"SIGOURE" == SIGOURE Benoit <sigoure.benoit@lrde.epita.fr> writes:
https://svn.lrde.epita.fr/svn/xrm/trunk Index: ChangeLog from SIGOURE Benoit <sigoure.benoit@lrde.epita.fr>
Add lazy and/or evaluation at the meta-level. One can now rely on laziness of logical operators to prevent what could be an error at the meta-level, eg: x > 0 & s[x-1]=0
Brilliant, thanks!
eval-meta-code = eval-meta-if + <+ lazy-eval-and + <+ lazy-eval-or <+ unroll-meta-for <+ unroll-meta-forin <+ (expand-pformulas; eval-meta-code) // try again on expansed code. @@ -72,6 +81,26 @@ end end
+ lazy-eval-and = + ?|[ e1 & e2 ]| + ; <prism-desugar> e1 + ; try(LitToBool) => e1' + ; if !e1' => False() then + !False() + else + fail + end + + lazy-eval-or = + ?|[ e1 | e2 ]| + ; <prism-desugar> e1 + ; try(LitToBool) => e1' + ; if !e1' => True() then + !True() + else + fail + end
I'm surprised not to see some code removed: I believe you are already handling things such as "true & e" elsewhere.
Because it's different here. All the evaluation stuff is in prism-desugar, but here I don't want to prism-desugar everything. That's why the traversal made by eval-meta-code does that `lazy' evaluation of logical operators `by hands' (in fact it does rely on prism-desugar). I'm not sure whether I've been clear :s -- SIGOURE Benoit aka Tsuna _____ /EPITA\ Promo 2008.CSI Rock & tRoll