[racket] user's guide feedback/questions as I prepare for my PL course

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 26 11:25:40 EDT 2011

Hi Dan,

At Fri, 26 Aug 2011 08:09:11 -0700, Dan Grossman wrote:
> 7. I'm having trouble understanding modules and the rules about
> re-definitions.  I need to re-read Chapter 6 for a third time, cook up
> from examples, and post a full message just on this topic.  

For what it's worth, but I just rewrote section 6.1. Here's the latest
version:

 http://pre.racket-lang.org/docs/html/guide/module-basics.html

The `raco link' tool described in 6.1.2 only exists in the latest
Racket.

I still need to revise the rest of the chapter, so let me know if you
have other specific thoughts.

> I think
> the User's Guide docs are partly to blame for my confusion.  To pick
> on two examples I'm ready to discuss:
> 
> a. Section 4.2 reports, "A module-level define can bind only
> identifiers that are not already bound within the module. For example,
> (define cons 1) is a syntax error in a racket module, since cons is
> provided by racket."   Whether this is true perhaps depends on what you
> mean by "a racket module".  A module written in the racket language
> seems to have no trouble re-defining cons internally at its top-level:
>     #lang racket
>     (define cons +)
>     (cons 1 2) ; 3

The Guide is wrong. That claim was true when I wrote it, but we changed
modules to allow identifiers from the language to be shadowed by
definitions in the module. I'll fix the Guide.

> b. The contracts chapter reports, "To experiment with multiple modules
> within a single module or within DrRacket’s definitions area, use the
> racket/load language. The contents of such a module can be other
> modules (and require statements), using the longhand parenthesized
> syntax for a module (see The module Form)."  This would have been very
> good to know in the Modules chapter, or at the very least an explicit
> comment that racket modules can't contain other modules.  (Sorry if I
> missed it.)  That said, for simplicity, I'm tempted for my class to
> stick to racket and simply use multiple files for my modules examples
> -- if nothing else, it helps indicate that Racket isn't a toy language
> where everything goes in one file.

I'll probably defer this change. It may become possible to nest modules
in the near future.


Thanks!




Posted on the users mailing list.