On 11/21/17 2:57 AM, Alex Harsanyi wrote:
I'm trying to use the "raco check-requires" command to determine which
requires I should remove from my source files, and the command fails when I
include one of my files (the application compiles and runs fine).

I managed to reproduce the case as follows:

    ;; Save this in "file1.rkt"
    #lang racket/base
    (require racket/class)

    (define foo%
      (class object%
        (init-field name)

    (provide foo%)

    ;; Save this in "file2.rkt"
    #lang racket/base
    (require "file1.rkt")

When running check requires ("raco check-requires file2.rkt"), I would
that "file1.rkt" to be reported as a useless include, instead I get the
following error:

    $ raco check-requires file2.rkt
    derivation-parser: error on token #280: <macro-post-transform,
(detect-field-unsafe-undefine...> .
#<syntax:E:\Alex\t\al\al2\rkt\file1.rkt:5:2 (class object% (init-field
    (file "file2.rkt"):
    ERROR in (file "file2.rkt")

Interestingly, if I compile the files using "raco make file2.rkt", the
check-requires command works fine:

    $ raco make file2.rkt
    $ raco check-requires file2.rkt
    (file "file2.rkt"):
    DROP "file1.rkt" at 0

Could someone clarify what is "check-requires" complaining about in the
case?  Is this command only supposed to be run after the code was compiled?

That's an internal error in the implementation of check-requires, which reuses parts of the macro stepper. When compiled/file1_rkt.zo doesn't exist, expanding file2.rkt causes file1.rkt to be compiled (but not saved as a .zo file). Macro stepper "events" are supposed to be emitted in expand mode but not in compile mode, but during the compilation of file1.rkt, some events are getting emitted anyway (that's the real bug), and that confuses the event parser.

I've committed a workaround that should fix this particular problem, but the underlying problem will probably be more difficult.


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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to