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

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Mon May 29 15:38:14 EDT 2006

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!


Posted on the users mailing list.