[plt-scheme] running mzscheme in 3.99.0.23
At Sat, 03 May 2008 16:31:25 -0400, Prabhakar Ragde wrote:
> Matthias Felleisen wrote:
> >
> > When you're in a module, things are printed out.
That's not quite right. The `scheme' and `scheme/base' module languages
automatically print the results of top-level expressions in a module
body. The `mzscheme' module language doesn't do that (as it didn't in
3xx).
For example, the program
#lang mzscheme
10
doesn't print 10.
> > When you're in a teaching language, the implicit module installs a
> > non-printer at top-level.
A bit more precisely, the`lang/htdp-beginner', etc. module languages do
not print the results of top-level expressions.
Going back to the original question:
> What governs what is
> printed out, and can I change either of these behaviours?
The module's language is in charge via the `#%module-begin' binding.
If you create a new module language, then you can re-export
`#%module-begin' from `scheme/base' to have top-level expression values
printed, or you could re-export `#%plain-module'begin' as
`#%module-begin' to have top-level expressions results ignored.
Changing an existing language is tricker. If you know that the
language's `#%module-begin' is the same as `scheme/base' or the same as
`#%plain-module-begin', then you could create a new language that
re-exports everything of the existing language, except that it
re-exports the other `#%module-begin'. If the existing language has a
more complicated `#%module-begin', however (which is the case for the
`htdp' languages), then it's a problem of composing `#%module-begin's,
which doesn't work in general.
In particular, I don't see an easy way of creating a variant of
`lang/htdp-beginner' that prints the results of top-level expressions,
but I'll think about it more.
> Is there a description of exactly what is different between #lang scheme
> and #lang scheme/base? (I'm thinking of the equivalent of footnote 1 to
> section 2 of the DrScheme Programming Environment Manual in 3xx.)
I'll add something like that to the reference manual. (It will be
computed automatically from existing annotations in the documentation
source.)
Matthew