Racket Module Stuff

By Xah Lee. Date:

2015-10-23 WARNING THIS IS WORK IN PROGRESS. IT'S ALL WRONG.

2015-10-23 here's random notes.

The #lang at the start of a module file begins a shorthand for a module form,

~/apps/racket/doc/guide/Module_Syntax.html#%28part._hash-lang%29

Declaring a module does not immediately evaluate the body definitions and expressions of the module. The module must be explicitly required at the top level to trigger evaluation. After evaluation is triggered once, later requires do not re-evaluate the module body.

In the case of #lang racket, the syntax is

    #lang racket
    decl ...

which reads the same as

    (module name racket
      decl ...)

(module name-id initial-module-path
  decl ...)

(provide (rename-out [literal-read read]
                     [literal-read-syntax read-syntax]))

http://docs.racket-lang.org/guide/hash-lang_reader.html


something interesting when reading racket's doc.

on this page http://docs.racket-lang.org/guide/Module_Syntax.html#%28part._hash-lang%29, it says

In the case of #lang racket, the syntax is

#lang racket
decl ...

which reads the same as

(module name racket
  decl ...)

where name is derived from the name of the file that contains the #lang form.

but on this page http://docs.racket-lang.org/guide/module-languages.html#%28part._s-exp%29, it says

#lang s-exp module-name
form ...

is the same as

(module name module-name
  form ...)

can you spot a logical inconsistency?

there are 4 form: 1A, 1B, 2A, 2B. We have a transformation like this:

Forms 1B and 2B have the same shape. But forms 1A and 2A have different shape.

can you to resolve this paradox in purely logical terms?