@mflatt & @robby If I run this program in DrRacket and the command line:
#lang racket
(variable-reference->module-path-index (#%variable-reference))
In the command line I get a relative path:
#<module-path-index:(file "samples/wat.rkt")>
But in DrRacket I get an absolute one:
#<module-path-index:#<path:/home/leif/papers/interactive-syntax/samples/wat.rkt>>
Do either of you know why you get a difference?
Its…err…well…giving me inconsistent behavior when building a paper in DrRacket vs in the command line.
The racket
executable reflects how you referenced the module in the first place. So, I think you ran with racket samples/wat.rkt
as opposed to racket /home/leif/papers/interactive-syntax/samples/wat.rkt
. DrRacket always references (effectively) the module as an absolute path.
@mflatt Interesting. Although when I run it from the command line with an absolute path, it still comes up differently than drracket.
$ racket /home/leif/papers/interactive-syntax/samples/wat.rkt
#<module-path-index:(file "/home/leif/papers/interactive-syntax/samples/wat.rkt
Woops, missed the last bit of line: $ racket /home/leif/papers/interactive-syntax/samples/wat.rkt
#<module-path-index:(file "/home/leif/papers/interactive-syntax/samples/wat.rkt")>
Anyway, the difference between in DrRacket its a path, in the command line, its a string.
Ah, okay. I think I get it. So if I do something like: $ racket
> (define mp (path->complete-path "wat.rkt"))
> (dynamic-require mp #f)
#<module-path-index:#<path:/home/leif/papers/interactive-syntax/samples/wat.rkt>>
Which looks a lot like DrRacket’s output. So I suspect its doing something like that. Thanks.
Racket Stories now has more than a 100 links! https://racket-stories.com/
That’s a nice Christmas present ! Thank you @soegaard2 for building Racket Stories