Re: Stack traces for phase 1 errors?

Matthew Flatt <mflatt-sDh8Nw2yj/[email protected]>
Newsgroups gmane.comp.lang.racket.user,gmane.lisp.scheme.plt
Message-ID <[email protected]>
Errortrace cannot currently give you traces for phase-1 code in the
module being expanded. That's because errortrace works by first fully
expanding a module and then instrumenting it.

If you can arrange for the compile-time code to be in a different
module than the one that triggers the error, you'll get a trace. For
example, with

 ;; bad.rkt
 #lang racket

 (begin-for-syntax
   (define (bad-fn x)
     (string-append x 3)))

 (provide (for-syntax bad-fn))

and

 ;; use.rkt
 #lang racket
 (require "bad.rkt")

 (define-syntax foo (bad-fn ""))

then you should get errortrace info that points at the `string-append`
expression.


At Mon, 9 Jan 2017 11:29:36 -0800, Alexis King wrote:
> I have run into a few situations lately where I would really
> appreciate stack traces for errors in my compile-time code. However,
> I can’t figure out how to get errortrace to work with errors that
> occur at compile-time. For example, here’s a simple program:
> 
>   #lang racket
> 
>   (begin-for-syntax
>     (define (bad-fn x)
>       (string-append x 3)))
> 
>   (define-syntax foo (bad-fn ""))
> 
> If I run this with the following command, without compiling it:
> 
>   $ racket -l errortrace -t phase1-error.rkt
> 
> …I get an error message with an “errortrace...:” block, but no
> actual information in that block.
> 
> Is there any way to get stack trace information for these kinds of
> errors?
> 
> Alexis
> 
> -- 
> 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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.