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

Re: [plt-scheme] Weird problem



On May 16, Matthew Flatt wrote:
> At Thu, 16 May 2002 19:20:54 -0400, Eli Barzilay wrote:
> > It looks like something is not working right with units...  This works
> > fine for me:
> > 
> >   (require (prefix compiler: (lib "option.ss" "compiler")))
> >   (compiler:verbose #t)
> > 
> > but this claims that `compiler:verbose' is undefined:
> > 
> >   (begin (require (prefix compiler: (lib "option.ss" "compiler")))
> >          (compiler:verbose #t))
> 
> The problem is that MzScheme tries to compile the entire `begin'
> expression before acting on any part of it. In particular, it tries
> to compile the `compiler:verbose' reference before actually
> importing "option.ss".

Ah.  Actually, I don't have any problem not having that begin, but it
might be a problem macros...  I tried this:

  (begin (require (prefix compiler: (lib "option.ss" "compiler")))
         (namespace-variable-value 'compiler:verbose #t))

and it didn't complain, but it didn't have any effect...


> This is a problem with top-level expressions, and I'm not sure how
> to fix it. Naturally, you can avoid the problem by putting the
> `begin' expression inside a `module'.

Which brings me to another question...  Since there is a
`define-macro' around, the only constant problem that is left and
keeps popping up is the separation between the compile & run-time
environments.  While this is generally a good thing, some times it is
something which is desirable, but AFAICT, the only way to get this
effect is to drop the bindings in a module and both require and
require-for-syntax (well, almost, I guess that the *bindings* will be
different, but the values will be shared).  So the question is -- is
there any way to write a small (one definition) module just for things
like this -- it looks like module names have the single global name
space problem...

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!