PasteRack.org
Paste # 84562
2019-09-28 00:41:00

Fork as a new paste.

Paste viewed 420 times.


Embed:

#lang racket

> (require racket/rerequire)
> (define ns (make-base-empty-namespace))
> (dynamic-rerequire "baz.rkt")
'(#<path:/Users/john/baz.rkt>
  #<path:/Applications/Racket v7.3/collects/racket/main.rkt>
  #<path:/Applications/Racket v7.3/collects/syntax/compiled/module-reader_rkt.zo>
  #<path:/Applications/Racket v7.3/collects/syntax/compiled/readerr_rkt.zo>)

;;; [Attach module to namespace ns]
> (namespace-attach-module (current-namespace) "baz.rkt" ns)

;;; [Suspend racket, and change baz.rkt]
> ^Z
$ vim baz.rkt

;;; [resume racket, and try to reload baz.rkt]
$ fg %1
> (dynamic-rerequire "baz.rkt")
  [re-loading /Users/john/baz.rkt]
; module: current code inspector cannot redeclare module
;   module name: #<resolved-module-path:"/Users/john/baz.rkt">