diff --git a/conv.c b/conv.c index c3ebb03..e7c0bfc 100644 --- a/conv.c +++ b/conv.c @@ -179,11 +179,15 @@ static void enclose(Format *f, Binding *binding, const char *sep) { if (binding != NULL) { Binding *next = binding->next; enclose(f, next, ";"); +#if !ABRIDGE_CLOSURES + fmtprint(f, "%S%s", binding->name, sep); +#else fmtprint(f, "%S=%#L%s", binding->name, binding->defn, " ", sep); +#endif } } -#if 0 +#if ABRIDGE_CLOSURES typedef struct Chain Chain; struct Chain { Closure *closure; @@ -199,7 +203,7 @@ static Boolean Cconv(Format *f) { Binding *binding = closure->binding; Boolean altform = (f->flags & FMT_altform) != 0; -#if 0 +#if ABRIDGE_CLOSURES int i; Chain me, *cp; assert(tree->kind == nThunk || tree->kind == nLambda || tree->kind == nPrim); @@ -226,7 +230,7 @@ static Boolean Cconv(Format *f) { fmtprint(f, "%T", tree); } -#if 0 +#if ABRIDGE_CLOSURES chain = chain->next; /* TODO: exception unwinding? */ #endif return FALSE; diff --git a/esconfig.h b/esconfig.h index 9b4c054..4788523 100644 --- a/esconfig.h +++ b/esconfig.h @@ -15,6 +15,13 @@ * line definitions. (That is, remember to do the #ifndef dance.) * * + * ABRIDGE_CLOSURES + * if on, produce closure strings without the values bound in a closure: + * %closure(x;y;x)@ * {...} + * else: + * %closure(x=1;y=4;x=9)@ * {...} + * this is particularly useful when dealing with "nested bindings". + * * ASSERTIONS * if this is on, asserts will be checked, raising errors on * actual assertion failure. @@ -276,6 +283,10 @@ * default defaults -- don't change this section */ +#ifndef ABRIDGE_CLOSURES +#define ABRIDGE_CLOSURES 1 +#endif + #ifndef ASSERTIONS #define ASSERTIONS 1 #endif