On Thu, Nov 12, 2015 at 6:02 PM, Thomas Lynch
<[email protected]> wrote:
> It is not the very nature of errors that we do not expect them, and do not
> predict them with specificity, so it is incumbant upon racket to give
> location infomration with errors, rather than for the programmer to do so?
> Or am I missing something here?
I think you're missing where you discard the location information
Racket gives you? :)
Following Robby's cue and glancing at your `provide-with-trace` macro
in test-lib.rkt, it seems like that's the source (no pun intended) of
this? View-from-orbit it seems to be:
(define-syntax (provide-with-trace stx)
(datum->syntax
(manipulate-stuff-as-raw-s-expression
(syntax->datum stx)))
This will "slice off" all the interesting source location information
from the original syntax, `stx`. (Unlike some other lisps, Racket
syntax transformers get not just the s-expression datum, but full
syntax objects -- which also include information about things like
source location and lexical scope.)
I think it would be easier If you instead use `syntax-case` or
`syntax-parse` in the usual way -- supplying a `#'` a.k.a. `syntax`
template that uses pieces of the original syntax from the pattern.
Most likely it will preserve all the source info you want,
automatically.
As a quick experiment, change it to a do-nothing "identity" macro that
returns the original, full syntax-object as-is:
(define-syntax (provide-with-trace stx)
stx)
And see if this (plus errortrace) gives you good-enough error
messages. (This assumes you can still run your program OK without the
extra tracing stuff defined.)
If it does, then you could look into rewriting the macro in the
"normal" way to preserve syntax object info.
--
You received this message because you are subscribed to the Google Groups
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-dev/CAGspUn1PhT9dueOTGeY1ozrq3xH1_7tOdPej%3Dd_aoLnsor3Shw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.