Mysterious issue with pict/code

53 views
Skip to first unread message

Stephen Foster

unread,
Oct 5, 2019, 12:56:40 PM10/5/19
to Racket Users
I spent a few hours tracking down a mysterious bug.  Although I've fixed it, I still don't understand it. I would appreciate some insight from those who understand these things better.

Here's the simple reproduction:

main.rkt:

#lang racket

(define-syntax (test stx)

 
(dynamic-require "./other.rkt" #f)

 
#'(displayln "HI"))

;This is fine
(dynamic-require "./other.rkt" #f)

;This triggers the error
(test)


And other.rkt is simply:

#lang racket

(require pict/code)

The error when running main.rkt is:

no module instance found: #<resolved-module-path:"/Applications/Racket v7.4/collects/racket/private/list.rkt"> 0


  context...:


   namespace->module-namespace82


   copy-namespace-value


   temp250


   for-loop


   [repeats 1 more time]


   perform-require!78


   /Applications/Racket v7.4/share/pkgs/compatibility-lib/mzscheme/private/old-procs.rkt:47:4: make-namespace


   .../racket/unit.rkt:996:20


   "/Applications/Racket v7.4/share/pkgs/pict-lib/pict/code.rkt": [running body]


   temp37_0


   for-loop


   run-module-instance!125


   for-loop


   [repeats 1 more time]


   run-module-instance!125


   apply-transformer-in-context


   ...




It would appear that the dynamic-require of a module that requires pict/code fails inside a macro, but not otherwise.  What's up with that?

--Stephen




Sam Tobin-Hochstadt

unread,
Oct 5, 2019, 3:33:47 PM10/5/19
to Stephen Foster, Racket Users
This definitely seems like a bug. Here's a smaller program that shows it:

#lang racket
(begin-for-syntax
(dynamic-require 'pict/code #f))

Sam
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/7acffe39-c491-4da6-b00b-2450e41f5008%40googlegroups.com.

Matthew Flatt

unread,
Oct 5, 2019, 9:42:04 PM10/5/19
to Sam Tobin-Hochstadt, Stephen Foster, Racket Users
Thanks for the report and simplification! I've pushed a repair.
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BYGMeCVCO_h_NXErf1LQWz
> NWxmBXWTQNt%3DUt2iyyVv5Yw%40mail.gmail.com.

Stephen Foster

unread,
Oct 7, 2019, 12:24:05 PM10/7/19
to Matthew Flatt, Sam Tobin-Hochstadt, Racket Users
Awesome!  Thanks. :)

Just for my own curiosity, is it this commit or a different one? 




You received this message because you are subscribed to a topic in the Google Groups "Racket Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/racket-users/ouNaokcNdpo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/5d994668.1c69fb81.28e90.27b3SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


--


Stephen Foster
ThoughtSTEM Co-Founder

Matthew Flatt

unread,
Oct 7, 2019, 12:53:11 PM10/7/19
to Stephen Foster, Racket Users
Yes, that one (combined with the previous commit).
> https://groups.google.com/d/msgid/racket-users/CA%2BzSu29PCzOtjZSjHegoJ%3D3KM-%
> 3DCB1mOnvQOCTR-dsvkjzsCpg%40mail.gmail.com.

Stephen Foster

unread,
Oct 8, 2019, 12:14:35 PM10/8/19
to Matthew Flatt, Racket Users
Thanks! 
Reply all
Reply to author
Forward
0 new messages