[racket] using syntax/modcode and make-base-namespace

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon May 23 23:08:20 EDT 2011

I think the problem is with the Matrix snip class, which has only a
GUI-compatible implementation and not a non-GUI implementation.

To fix this pronlem, the Matrix snip class should be changed to set a
different snip-class name to support non-GUI mode. In addition, to
support old files, the old snip-class name #"(lib \"matrix.ss\"
\"htdp\")" could be hardwired into the "wxme" collection, which handles
snip reading in non-GUI mode.

At Fri, 20 May 2011 11:45:53 -0400, Danny Yoo wrote:
> I'm using syntax/modcode, and am running across an error that I don't
> understand yet.  Here's test code to demonstrate:
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> #lang racket
> 
> (require syntax/modcode)
> 
> (define collects-dir
>   (normalize-path
>    (let ([p (find-system-path 'collects-dir)])
>      (cond
>        [(relative-path? p)
>         (find-executable-path (find-system-path 'exec-file)
>                               (find-system-path 'collects-dir))]
>        [else
>         p]))))
> 
> (void
>  (parameterize ([current-namespace (make-base-namespace)])
>    (get-module-code (build-path collects-dir "htdp" "tests"
> "matrix-client.rkt"))))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> 
> 
> I see the following error:
> 
> ##########################################################################
> read-syntax: cannot load snip-class reader: #"(lib \"matrix.ss\" \"htdp\")"
> 
>  === context ===
> /research/plt/software/racket/5.1.1/std/collects/wxme/wxme.rkt:382:2: find-class
> /research/plt/software/racket/5.1.1/std/collects/wxme/wxme.rkt:208:2: read-snip
> /research/plt/software/racket/5.1.1/std/collects/wxme/wxme.rkt:617:4: read-proc
> /research/plt/software/racket/5.1.1/std/collects/mzlib/port.rkt:167:4:
> do-read-it
> /research/plt/software/racket/5.1.1/std/collects/lang/htdp-reader.rkt:13:4: loop
> /research/plt/software/racket/5.1.1/std/collects/lang/htdp-reader.rkt:13:4: loop
> /research/plt/software/racket/5.1.1/std/collects/wxme/wxme.rkt:695:2:
> wxme-read-syntax
> /research/plt/software/racket/5.1.1/std/collects/syntax/modcode.rkt:47:8
> /research/plt/software/racket/5.1.1/std/collects/syntax/modcode.rkt:79:2: core
> ##########################################################################
> 
> 
> Am I misusing it?
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users


Posted on the users mailing list.