[racket] Module Availability
Thats what I thought it was, but I cannot replicate with the following
program.
secret.rkt
#lang racket/base
(provide (all-defined-out))
(define secret 1)
secret-stx.rkt:
#lang racket/base
(require (for-template "secret.rkt"))
(provide use-secret)
(define (use-secret) #'secret)
secret-user.rkt
#lang racket/base
(require (for-syntax racket/base))
(define-syntax (go stx)
(define use-secret (dynamic-require "secret-stx.rkt" 'use-secret))
(use-secret))
(go)
The resulting program from compiling secret-user shouldn't have any
dependency on secret, yet it works.
On Fri, Feb 8, 2013 at 9:35 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu>wrote:
> On Fri, Feb 8, 2013 at 12:26 PM, Eric Dobson <eric.n.dobson at gmail.com>
> wrote:
> > I'm trying to understand why TR requires a module that it doesn't
> actually
> > use in the file that requires it.
> >
> > The requirement is unstable/contract in typed-racket/type-racket.rkt.
> > Without it tests/typed-racket/succeed/succed-cnt.rkt fails. But when I
> try
> > to reduce the test case to not use TR, I cannot replicate it.
>
> This require is there so that the residual program is correct. The
> basic issue is that Typed Racket dynamically loads large parts of its
> implementation, some of which is used to produce the residual code in
> the expansion of a TR module (such as contracts, which can use
> `unstable/contract`). However, the resulting program must contain a
> dependency on `unstable/contract`, otherwise Racket can't figure out
> how to evaluate the reference. Therefore, the part of TR that is *not*
> dynamically loaded needs to declare a static dependency on
> `unstable/contract`.
>
> Sam
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130208/21457aa2/attachment.html>