[plt-scheme] I don't understand libraries

From: Jon Stenerson (jonstenerson at comcast.net)
Date: Sun May 16 10:41:15 EDT 2010

Thanks. That makes sense. 

I see that the library expands from one to four times depending on
whether debugging is enabled, and whether I press the run or the debug
button.

Module Lang with debugging disabled
  run - one foo
  debug - two foos


Module Lang with debugging enabled
  run - three foos
  debug - four foos

Looks like enabling debugging in the Choose Language dialog causes the
library to be expanded an additional two times.

Jon


On Sun, 2010-05-16 at 07:41 -0500, Robby Findler wrote:
> If you disable debugging, then it only prints once (at least in the
> latest git-based version). Debugging is implemented by expanding the
> program and then inserting instrumentation code and then re-expanding,
> so that accounts for two of the prints, but I'm not sure where the
> third is coming from.
> 
> But in general, in that program, you are going to get one print each
> time it is expanded.
> 
> Robby
> 
> On Sun, May 16, 2010 at 12:04 AM, Jon Stenerson
> <jonstenerson at comcast.net> wrote:
> > Why does this print "foo" three times? I'm using drscheme and the module
> > language. Is lib being read three separate times when I press ctrl-t? Or
> > is foo being defined three times? Or what? I don't get it.
> >
> > #!r6rs
> >
> > (library (lib)
> >
> >  (export x)
> >  (import (rnrs))
> >  (define x 0)
> >
> >  (define-syntax foo (display "foo\n") )
> > )
> >
> > _________________________________________________
> >  For list-related administrative tasks:
> >  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >




Posted on the users mailing list.