bug-kawa
[Top][All Lists]
Advanced

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

[Bug-kawa] [bug #43285] Require vs. load


From: Per Bothner
Subject: [Bug-kawa] [bug #43285] Require vs. load
Date: Tue, 23 Sep 2014 18:16:49 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0

Update of bug #43285 (project kawa):

                  Status:                    None => Invalid                
             Assigned to:                    None => bothner                

    _______________________________________________________

Follow-up Comment #1:

It's not a bug, as I see it.

When you evaluate x.scm (without using -f or the load function) it is parsed
in module-at-a-time mode.  The entire file is compiled into a module, which is
then loaded.  When x.scm requires y.scm, the definition of foo is added to the
*lexical* scope of x.scm, not the dynamic environment.  When x.scm is
evaluated, it loads z.scm, which looks for foo in the dynamic environment,
where it is not.

There is a special hack for the interactive top-level: *After* evaluating a
require, all the of exported bindings are added to the dynamic environment.

It might be possible to add the exported bindings to the dynamic environment
*before* evaluating the module body, though maybe not in all cases, and it's a
bit tricky.  (See the code in ModuleExp.evalModule2.)

Note if you run x.scm in line-at-a-time mode (e.g by using the -f flag) things
work as expected.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43285>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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