[plt-scheme] Re: modules 4 newbies

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Oct 17 10:10:27 EDT 2008

On Oct 16, Raoul Duke wrote:
> hi,
> 
> thanks to you all for your notes!
> 
> but, ok, it still seems to me to be designed to confused newbies :-)
> 
> (0) if the newbie starts with the "in pictures" docs and goes through
> all of them from start to finish, then they might not get screwed up.
> 
> otherwise, the main things which confused me are: (A) "(module..."
> vs. "#lang" and (B) when using #lang, how to 'name' the module.

IIUC, the thing that confused you was old pieces of documentation and
other material that you found via google.  If you just hit F1 in
drscheme when the cursor is on the `#lang', or just hit F1 and enter
`#lang' in the search you get one reference entry that specifies it,
and one guide entry that explicitly talks about how `#lang' is read in
as a (module ...) expression.


> i think it is easy for a newbie to get confused about it all
> because:
> 
> (1) seems most intros start the newbie off with "#lang" which is
> incompatible with the "(module..." way.

They're not incompatible, they're just similar ways to specify the
language of a file.  `#lang' is preferred since it can do more (ie,
make the module use a different reader).  It's good that all intros
use it -- it should be a strong hint that you should use it too.


> (2) but the 'real' plt scheme docs talk about using "(module..." still
> and don't mention how "#lang" factors into that.
> http://download.plt-scheme.org/doc/4.1/html/reference/eval-model.html#(part._module-eval-model)

The "Evaluation Model" is most definitely not something that a newbie
should start from.  This is why the first entries on the documentation
page are all "guide" manuals.  But it seems that none of that would
help if your approach is to use google to find documentation.  If you
just ran `plt-help', you'd see those guides first, and I suspect that
much of your confusion would never have happened.


> tho i'd say that even that isn't complete since it doesn't
> explicitly say what the name of the module is in the latter case,
> whereas it is explicitly typed in by the developer when they use the
> "(module..."  form. i assume that the name of the module via the
> "#lang" approach is whatever the name of the file it is saved in
> happens to be, minus the extension (and ignoring issues of path
> depth).

Right.  As a *newbie* you shouldn't even care about such details.
This is why `#lang' is doing what it's doing -- all you need to do is
prefix your file with `#lang scheme' (or `#lang scheme/gui') and start
writing code.  (And in the initial stages of experimenting with the
environment you shouldn't even care about the fact that your file is a
"module" -- that should come later.)

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


Posted on the users mailing list.