[racket] module->language-info at repl

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Thu Sep 1 16:48:45 EDT 2011

Ah yes I see now. So everyone understands what is happening now I have

#lang Z/private
(require racket/base)
(provide (all-from-out racket/base))

#lang s-exp syntax/module-reader
#:language-info #(Z/private/runtime configure 'dont-care)

#lang racket/base
(provide (all-from-out racket/base))

#lang racket/base

(provide configure)
(define (configure . args)
  (printf "called configure with ~a\n" args)

Welcome to Racket v5.1.3.6.
called configure with ((quote dont-care))
procedure application: expected procedure, given: #f; arguments were: 'configure-runtime '()

Now of course I have to provide the right thing from `configure'.

On 09/01/2011 02:32 PM, Matthew Flatt wrote:
> The `-I' flag just sets a module to `require' by default, so it's the
> same issue as in Sam's question.
> Probably you want to write "Z/main.rkt" itself in a language whose
> runtime configuration is the same as for modules implemented with
> `#lang Z'. See "racket/main.rkt" and "racket/base.rkt", for example,
> which are implemented in the `racket/private' language.
> At Thu, 01 Sep 2011 14:23:04 -0600, Jon Rafkind wrote:
>> I changed #:info to
>> #:language-info #('Z/runtime configure 'dont-care)
>> And added Z/runtime.rkt with
>> #lang racket/base
>> (provide configure)
>> (define (configure . args)
>>   (printf "called configure with ~a\n" args)
>>   #f)
>> But the printf doesn't happen. Is the '-Iq Z' flag not the right incantation?
>> On 09/01/2011 01:43 PM, Matthew Flatt wrote:
>>> Instead of `#:info', you want to specify `#:language-info'.
>>> The `#:info' hook is for things related to the *source* of a module in
>>> the language, such as syntax coloring in DrRacket for a module that
>>> start `#lang Z'. The plain `racket' REPL doesn't deal with the module's
>>> source at all in that sense.
>>> The `#:language-info' hook is for things related to *running* a module
>>> that starts `with `#lang Z'. When such a module is provided to
>>> `racket', then `racket' uses `configure-runtime' before instantiating
>>> the module.

Posted on the users mailing list.