PasteRack.org
Paste # 27026
2018-08-03 08:15:36

Fork as a new paste.

Paste viewed 91 times.


Embed:

  1. #lang racket
  2. (require syntax/location)
  3.  
  4. (module my-top racket
  5.   (provide (rename-out [#%my-top #%top]))
  6.   (require (for-syntax syntax/parse racket/base))
  7.   (define-syntax (#%my-top stx)
  8.     (syntax-parse stx
  9.       [(_#%my-top . id:id)
  10.        (syntax/loc stx
  11.          (raise-syntax-error '#%my-top "reference to unbound identifier" stx id))])))
  12.  
  13.  
  14. (define ns (make-base-empty-namespace))
  15. (parameterize ([current-namespace ns])
  16.   (namespace-require (quote-module-path my-top)))
  17.  
  18. (eval #'(let ([x 1])
  19.           (+ x y 1))
  20.       ns)

=>

require: unknown module

  module name: #<resolved-module-path:(submod 'm my-top)>

?: module mismatch;

 attempted to use a module that is not available

  possible cause:

   using (dynamic-require .... #f)

   but need (dynamic-require .... 0)

  module: "/home/pasterack/racket68/collects/racket/private/

qq-and-or.rkt"

  phase: 0

  in: let