[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] serious bug ? in units and set!
From: |
Thomas Bushnell BSG |
Subject: |
Re: [Chicken-hackers] serious bug ? in units and set! |
Date: |
Tue, 22 Sep 2009 00:44:47 -0700 |
What are you talking about? Nothing in test2.scm establishes a binding
for foo.
Thomas
On Tue, 2009-09-22 at 00:08 -0500, Jim Ursetto wrote:
> An actual example of what you're trying to achieve would probably
> help, because the example you gave is rather convoluted.
>
> But it short it doesn't "work" (for certain values of work) because
> you exported "blah" in test2.scm, implying -- as a consequence -- that
> every other binding is hidden, including "foo". So the compiler does
> an optimization where "foo" is not looked up globally but locally in
> test2. Then, as a further optimization since you didn't give foo any
> value to start with, the compiler just chooses 'whiz for the default,
> moving the set! to toplevel initialization time, which is actually
> pretty neat.
>
> In short, change (export blah) to (export blah foo) in test2.scm and
> it will behave as you desire... I guess. :)
>
> On Mon, Sep 21, 2009 at 8:31 PM, Thomas Bushnell BSG <address@hidden> wrote:
> > test2.scm contains:
> > (declare (unit test2) (export blah))
> > (define (blah) (display (format "foo: ~s\n" foo)) (set! foo 'whiz))
> >
> > main.scm contains:
> > (declare (uses test2) (export foo))
> > (define foo #t)
> > (blah)
> >
> > Compile with csc -o foo test2.scm main.scm and run it. And the output
> > is:
> >
> > foo: whiz
> >
> > On Chicken Scheme 3.4.0 in current Debian unstable.
> >
> > If all these definitions are put in one file, then the output is
> > foo: #t
> > as expected.
> >
> >
> >
> >
> > _______________________________________________
> > Chicken-hackers mailing list
> > address@hidden
> > http://lists.nongnu.org/mailman/listinfo/chicken-hackers
> >
- [Chicken-hackers] serious bug ? in units and set!, Thomas Bushnell BSG, 2009/09/21
- Re: [Chicken-hackers] serious bug ? in units and set!, Jim Ursetto, 2009/09/22
- Re: [Chicken-hackers] serious bug ? in units and set!,
Thomas Bushnell BSG <=
- Re: [Chicken-hackers] serious bug ? in units and set!, Thomas Chust, 2009/09/22
- Re: [Chicken-hackers] serious bug ? in units and set!, Thomas Bushnell BSG, 2009/09/22
- Re: [Chicken-hackers] serious bug ? in units and set!, Thomas Chust, 2009/09/22
- Re: [Chicken-hackers] serious bug ? in units and set!, Jim Ursetto, 2009/09/22
- Re: [Chicken-hackers] serious bug ? in units and set!, Thomas Chust, 2009/09/22
- Re: [Chicken-hackers] serious bug ? in units and set!, Jim Ursetto, 2009/09/22