From 146c880a873a04fc433125646dd998882354f1c5 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Wed, 8 May 2013 22:49:20 +0000 Subject: Almost pure function bodies are now %redex forms --- src/interp/c-util.boot | 12 +++++++++++- src/interp/compiler.boot | 6 ------ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/interp') diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 5a07644d..b6e253c3 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1421,6 +1421,16 @@ expandableDefinition?(vars,body) == ['XLAM,vars',body] nil +++ A list of routines for diagnostic reports. These functions, in an +++ abstract sense, have type: forall T: Type . String -> T, so they +++ can be used in T-returning functions, for any T. +$coreDiagnosticFunctions == + '(error userError systemError) + +almostPure? x == + ops := [:$coreDiagnosticFunctions,:$VMsideEffectFreeOperators] + semiSimpleRelativeTo?(x,ops) + ++ `defs' is a list of function definitions from the current domain. ++ Walk that list and replace references to unconditional operations ++ with their corresponding linkage names. @@ -1433,7 +1443,7 @@ foldExportedFunctionReferences defs == form := expandableDefinition?(vars,body) => registerFunctionReplacement(name,form) second(fun) := ["LAMBDA",vars,["DECLARE",["IGNORE",last vars]],body] - if sideEffectFree? body then + if almostPure? body then registerRedexForm(name,vars,body) lamex.absBody := body defs diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index ef8859cb..ebc3711a 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -76,12 +76,6 @@ reshapeArgumentList: (%Form,%Sig) -> %Form applyMapping: (%Form,%Mode,%Env,%List %Mode) -> %Maybe %Triple -++ A list of routines for diagnostic reports. These functions, in an -++ abstract sense, have type: forall T: Type . String -> T, so they -++ can be used in T-returning functions, for any T. -$coreDiagnosticFunctions == - '(error userError systemError) - $IOFormDomains == [$InputForm,$OutputForm,$Syntax] -- cgit v1.2.3