guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: slowness in guile 1.8


From: Andy Wingo
Subject: Re: slowness in guile 1.8
Date: Sat, 26 May 2007 12:49:54 +0200

Hey Ludovic,

Thanks for looking at this!

On Fri, 2007-05-25 at 20:12 +0200, Ludovic Courtès wrote:
> Alas, it breaks the following test in `syntax.test':

I'm not sure what "it" is in this case; I assume you mean the fix to
module-make-local-var!.

>   (pass-if "binding is created before expression is evaluated"
>     (= (eval '(begin
>                 (define foo
>                   (begin
>                     (set! foo 1)
>                     (+ foo 1)))
>                 foo)
>              (interaction-environment))
>        2))
> 
> This test case illustrates the fact that _internal_ defines are
> equivalent to `letrec' (Section 5.2.2); top-level defines should behave
> similarly for new variables (Section 5.2.1).

I don't know what you are trying to say here; top-level defines do not
"behave similarly" to letrec. R5RS says in section 5.2.1:

        If <variable> is not bound, however, then the definition will
        bind <variable> to a new location before performing the
        assignment, whereas it would be an error to perform a `set!' on
        an unbound variable.  

The new variable should be created before the assignment, but _not
necessarily before evaluation of the rhs_.

> For top-level defines as in `(define round round)', the rule is that
> `define' is equivalent to `set!' when the variable is already bound
> (Section 5.2.1).  This justifies the change made by Marius to
> `module-make-local-var!' (above).

Only if foo is already bound, in the case you gave, is the test
syntactically valid.

I think the test is bogus. MzScheme, Gambit, Scheme48, and Guile 1.6
think so too. You have snatched defeat from the jaws of victory ;-)

Suggest removing the test.

Cheers,

Andy.
-- 
http://wingolog.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]