[plt-scheme] Not quite understanding require-for-syntax's behavior

From: Ryan Culpepper (ryan_sml at yahoo.com)
Date: Mon May 29 15:48:08 EDT 2006

When you enable debugging in DrScheme, it expands your code, then
annotates it with debugging code, then expands/compiles it again.
Expanding the module twice accounts for the require-for-syntax
executing twice.

You might try using mzc or setup-plt to compile .zo files for your
modules. You could also turn off debugging in the Languages menu, but
then ... you lose debugging.

Ryan

--- Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:

> Hi everyone,
> 
> I'm seeing some kind of double-requiring behavior off of 
> require-for-syntax that's confusing me, and I'm not sure if I'm
> hitting a bug or not, or just seeing behavior that's undefined.
> 
> This involves DrScheme's Pretty Big Language:
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (module counter mzscheme
>       (printf "counter~n"))
> (module test-require-for-syntax mzscheme
>      (require-for-syntax counter))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> 
> When I evaluate this from DrScheme (301.15-svn22may2006), I see
> two printouts:
> 
> ;;;;;;;
> counter
> counter
> ;;;;;;;
> 
> I've tested this in DrScheme 301-svn18dec2005 and 208, so this
> behavior seems to be there for a while now.  It doesn't make
> sense to me though. 
> *grin*
> 
> Why would it need to require-for-syntax twice?
> 
> When I run this through plain mzscheme, I only see one:
> 
>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> metcalfe ~/work/dungeon $ mzscheme
> Welcome to MzScheme version 301.15, Copyright (c) 2004-2006 PLT
> Scheme 
> Inc.
> > (module counter mzscheme
>       (printf "counter~n"))
> > (module test-require-for-syntax mzscheme
>      (require-for-syntax counter))
> counter
>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> 
> 
> I'm looking at this only because it's affecting some project code
> that does some hefty require-for-syntax requires, and the amount
> of time DrScheme is taking in rerunning the modules is
> significant.  In some cases, I'm seeing DrScheme invoking a 
> require-for-syntax module four  times!
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 



Posted on the users mailing list.