From 2a52b4295e286373bf663d6b6880eb467e02526b Mon Sep 17 00:00:00 2001 From: Mikael Djurfeldt Date: Thu, 29 Jul 1999 18:15:24 +0000 Subject: [PATCH] *** empty log message *** --- NEWS | 40 +++++++++++++++++++ guile-config/ChangeLog | 5 +++ ice-9/ChangeLog | 5 +++ libguile/ChangeLog | 90 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 138 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 567a777e5..22105450f 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,46 @@ in backtraces. * Changes to Scheme functions and syntax +** Guile now correctly handles internal defines by rewriting them into +their equivalent letrec. Previously, internal defines would +incrementally add to the innermost environment, without checking +whether the restrictions specified in RnRS were met. This lead to the +correct behaviour when these restriction actually were met, but didn't +catch all illegal uses. Such an illegal use could lead to crashes of +the Guile interpreter or or other unwanted results. An example of +incorrect internal defines that made Guile behave erratically: + + (let () + (define a 1) + (define (b) a) + (define c (1+ (b))) + (define d 3) + + (b)) + + => 2 + +The problem with this example is that the definition of `c' uses the +value of `b' directly. This confuses the meoization machine of Guile +so that the second call of `b' (this time in a larger environment that +also contains bindings for `c' and `d') refers to the binding of `c' +instead of `a'. You could also make Guile crash with a variation on +this theme: + + (define (foo flag) + (define a 1) + (define (b flag) (if flag a 1)) + (define c (1+ (b flag))) + (define d 3) + + (b #t)) + + (foo #f) + (foo #t) + +From now on, Guile will issue an `Unbound variable: b' error message +for both examples. + ** Hooks A hook contains a list of functions which should be called on diff --git a/guile-config/ChangeLog b/guile-config/ChangeLog index 14225f8cc..fd361fac4 100644 --- a/guile-config/ChangeLog +++ b/guile-config/ChangeLog @@ -1,3 +1,8 @@ +1998-07-29 Marius Vollmer + + * guile-config.in (build-link): Correct non-RnRS usage of internal + defines. + 1999-04-17 Jim Blandy * Makefile.in: Regenerated. diff --git a/ice-9/ChangeLog b/ice-9/ChangeLog index 125b9b141..6fb60be9c 100644 --- a/ice-9/ChangeLog +++ b/ice-9/ChangeLog @@ -1,3 +1,8 @@ +1999-07-29 Marius Vollmer + + * boot-9.scm (error-catching-loop): Correct non-RnRS usage of internal + defines. + 1999-07-19 Jim Blandy * streams.scm: New module, contributed by Michael Livshin. diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 5e0d89c3d..e0ad0271b 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,13 +1,99 @@ 1999-07-29 Mikael Djurfeldt + * eval.c, tags.h, print.c (SCM_IM_SLOT_REF, SCM_IM_SLOT_SET_X): + New isym operations. + * eval.h: Added prototypes for multi language support functions. * eval.c (SCM_IM_DISPATCH, SCM_IM_HASH_DISPATCH): Don't use improper lists in the low-level representation, since that will cause a begin to be prepended at macro expansion. - * eval.c, tags.h, print.c (SCM_IM_SLOT_REF, SCM_IM_SLOT_SET_X): - New isym operations. + * eval.c (scm_cons_source): Version of cons which copies source + properties from an existing cell. + (scm_m_quote, scm_m_begin, scm_m_if, scm_m_set_x, scm_m_and, + scm_m_or, scm_m_case, scm_m_cond, scm_m_lambda, scm_m_letstar, + scm_m_do, scm_m_letrec, scm_m_let, scm_copy_tree): Use + scm_cons_source. + + * debug.c (scm_procedure_source): Cons SCM_IM_LAMBDA onto + procedure source before calling scm_unmemocopy instead of faking + an environment. + +1998-10-25 Marius Vollmer + + Ported `internal defines' fix from SCM. Original ChangeLog entry: + + 1998-07-09 Radey Shouman + + * eval.c (ceval_1): Modifications to allow rewriting of interal + DEFINE to LETREC: If an ISYM is evaluated in non-tail position the + body of which it is the CAR is macro expanded by m_expand_body, + which rewrites internal DEFINE. + + (m_expand_body): Added. + + (m_macroexp1): Added argument to control error checking: + m_expand_body may speculatively expand forms in the wrong + environments. Made argument number checks conditional on + RECKLESS. + + (m_body): Added, error checks bodies and inserts the ISYM tokens. + + (m_lambda): (m_letstar): (m_letrec1): (m_letrec): (m_let): Now + call m_body. + + (m_cond): (m_case): (m_quote): Modified to avoid destructively + changing their argument forms. Since m_expand_body + speculatively macro expands forms the process must be + reversible. + + (m_ident_eqp): Fixed to use proper environment. + + (renamed_ident): Added DEFER_INTS_EGC. + + Added prototypes for static functions. + + * eval.c + + (undef_cell): New. + + (scm_lookupcar1, scm_lookupcar): Added CHECK argument. When CHECK + is false, do not produce an error for unbound variables, return a + pointer to cell_undef instead. + + (EVALCELLCAR, XEVALCAR): Call scm_lookupcar with check=1. + + (scm_m_body): New. + + (scm_m_cond, scm_m_case, scm_m_quote): Modified to avoid + destructively changing their argument forms. Since m_expand_body + speculatively macro expands forms the process must be reversible. + + (scm_m_lambda): Use scm_m_body instead of bodycheck. Account for + SCM_IM_LET introduced by named lets. + + (scm_m_letstar): Use scm_m_body instead of bodycheck. + + (scm_m_letrec1, scm_letrec): Split scm_letrec into scm_letrec1 and + scm_letrec. scm_letrec1 does not check for a null binding and + takes an additional argument to specify the ISYM of the body. Use + scm_m_body instead of bodycheck. + + (scm_m_let): Use scm_m_body instead of bodycheck. + + (scm_m_expand_body, scm_macroexp): New. + + (unmemocopy): Account for ISYMs introduced by scm_m_body. + + (ceval, deval): Call scm_m_expand_body. Call scm_lookupcar with + check=1. Throw error for internal defined that have not been + rewritten by scm_m_expand_body. + + * eval.h: Added prototypes for scm_m_expand_body and scm_macroexp. + Removed prototype for SCM_APPLY. + + * tags.h: Added extern declaration of scm_isymnames. 1999-07-27 Mikael Djurfeldt -- 2.20.1