[plt-scheme] How to dynamic-require a syntax?

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Sun Dec 21 03:15:50 EST 2008

File t1.ss:

#lang scheme

(require scheme/package)

(define-package p #:all-defined
  (define x 1))

(provide p)


File t2.ss:

#lang scheme

(require scheme/package)

(define-syntax (load-package stx)
  (syntax-case stx ()
    ((load-package p)
     #`(open-package #,(dynamic-require '(file "t1.ss") (syntax->datum 
#'p))))))

(load-package p)

-Chongkai


Jon Rafkind wrote:
> Chongkai Zhu wrote:
>> I tried something like
>>
>> (define-syntax (my-macro stx)
>>  (syntax-case stx ()
>>    ((my-macro p)
>>     #`(... #,(dynamic-require '(file "t1.ss") (syntax->datum #'p)) 
>> ...))))
>>
> Works for me. Can you paste an entire example that segfaults?



Posted on the users mailing list.