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?

Here is another example:

   §lambda1:/home/deep/3_doc/snap-p> racket -l errortrace -t producer.rkt
   in: unbound identifier in module
     in: in
     errortrace...:

   §lambda1:/home/deep/3_doc/snap-p>

Very little information to go by here, and 'in' was not a variable in said
module.  Turned out to be a typo.

Does every identifier in a syntax transformer have to be handled as you
show above for error tracing to work, and what if there are errors in the
extra code, what locates those?






On Thu, Nov 12, 2015 at 12:48 PM, Robby Findler <[email protected]
> wrote:

> The .zo files are generally located in the compiled/ subdirectory next
> to the file you are running. You would get them if you run "raco make
> mc-lambda.rkt", for example. And that was my guess with the previous
> error, not the current one.
>
> With this error, it looks like a macro is expanding into a free
> variable and the source location information on the free variable
> isn't available for some reason. One reason might be that the
> identifier is synthesized by the macro, but the macro doesn't put any
> source location into the variable. Here is an example program that has
> that property:
>
> #lang racket
> (define-syntax (m stx)
>   (syntax-case stx ()
>     [(_ x)
>      (identifier? #'x)
>      (with-syntax ([x2 (datum->syntax
>                         #'x
>                         (string->symbol (format "~a2" (syntax-e #'x))))])
>        #'x2)]))
>
> (let ([x 1])
>   (m x))
>
> This one can be fixed by making the transformer pick a source location
> for the identifier that is in the macro itself like this:
>
> #lang racket
> (define-syntax (m stx)
>   (syntax-case stx ()
>     [(_ x)
>      (identifier? #'x)
>      (with-syntax ([x2 (datum->syntax
>                         #'x
>                         (string->symbol (format "~a2" (syntax-e #'x)))
>                         #'here)])
>        #'x2)]))
>
> (let ([x 1])
>   (m x))
>
> Or it may make more sense to pick a source location from the input to
> the macro like this:
>
> #lang racket
> (define-syntax (m stx)
>   (syntax-case stx ()
>     [(_ x)
>      (identifier? #'x)
>      (with-syntax ([x2 (datum->syntax
>                         #'x
>                         (string->symbol (format "~a2" (syntax-e #'x)))
>                         stx)])
>        #'x2)]))
>
> (let ([x 1])
>   (m x))
>
>
> Robby
>
> On Thu, Nov 12, 2015 at 1:02 AM, Thomas Lynch
> <[email protected]> wrote:
> > Ah,  I don't think I have any .zo files.  Can they be located elsewhere
> than
> > the pwd?  Here is a smaller example:
> >
> >
> > §lambda1:/home/deep/3_doc> tar -czf snap1.tgz snap1
> >
> > §lambda1:/home/deep/3_doc> cd snap1
> >
> > §lambda1:/home/deep/3_doc/snap1> ls
> > arith-lib.rkt  mc-lambda.rkt  sequence.rkt
> >
> > §lambda1:/home/deep/3_doc/snap1> racket -l errortrace -t mc-lambda.rkt
> > moniker: unbound identifier in module
> >   in: moniker
> >   errortrace...:
> >   context...:
> >
> >
> /usr/share/racket/pkgs/errortrace-lib/errortrace/errortrace-lib.rkt:434:2:
> > errortrace-annotate
> >
> /usr/share/racket/pkgs/errortrace-lib/errortrace/errortrace-lib.rkt:482:4
> >    standard-module-name-resolver
> >
> > A valid syntax transformer returns code with a function that is not
> > available to the module, "moniker".  Here racket does not tell the name
> or
> > where the syntax transformer is located,  it does not give the module or
> > line where the expansion occurs.
> >
> > On Wed, Nov 11, 2015 at 3:23 PM, Robby Findler <
> [email protected]>
> > wrote:
> >>
> >> Do you have .zo files compiled without errortrace turned on? If so,
> please
> >> throw them away and try again.
> >>
> >> Robby
> >>
> >>
> >> On Wednesday, November 11, 2015, Thomas Lynch
> >> <[email protected]> wrote:
> >>>
> >>> ok, I've been waiting for one of these squirrelly ones to come up so I
> >>> can try this error trace lib out. ..
> >>>
> >>> I've done something wrong here. No trace.. Line 294 is just the first
> >>> line of a macro definition, so no hint as to where it is used..   ..
> (Haha
> >>> though it is just a typo, this one is obvious..)
> >>>
> >>> dash el errortrace right  .. racket -l errortrace
> >>>
> >>>
> >>> §lambda1:/home/deep/liquid-parser/liquid> racket -t producer.rkt
> >>> symbol->string: contract violation
> >>>   expected: symbol?
> >>>   given: "producer-type::a-simple-byte-producer"
> >>>   context...:
> >>>    /home/deep/TCA-object/liquid/object.rkt:294:4
> >>>    standard-module-name-resolver
> >>>
> >>>
> >>> §lambda1:/home/deep/liquid-parser/liquid> racket -l errortrace -t
> >>> producer.rkt
> >>> symbol->string: contract violation
> >>>   expected: symbol?
> >>>   given: "producer-type::a-simple-byte-producer"
> >>>   errortrace...:
> >>>   context...:
> >>>    /home/deep/TCA-object/liquid/object.rkt:294:4
> >>>
> >>>
> /usr/share/racket/pkgs/errortrace-lib/errortrace/errortrace-lib.rkt:434:2:
> >>> errortrace-annotate
> >>>
> >>>
> /usr/share/racket/pkgs/errortrace-lib/errortrace/errortrace-lib.rkt:482:4
> >>>    standard-module-name-resolver
> >>>
> >>>
> >>>
> >>> On Sun, Nov 1, 2015 at 9:27 PM, Greg Hendershott
> >>> <[email protected]> wrote:
> >>>>
> >>>> On Fri, Oct 30, 2015 at 7:55 AM, Robby Findler
> >>>> <[email protected]> wrote:
> >>>> > Hi Thomas: you may wish to use errortrace to get more source
> locations
> >>>> > for error messages. It is enabled by default in DrRacket, but you
> have
> >>>> > to load it explicitly when you are working with the command-line
> >>>> > racket. Probably racket-mode has some support for it too, but I'm
> not
> >>>> > sure if it is turned on automatically there or not.
> >>>>
> >>>> In racket-mode for Emacs this is controlled by the
> >>>> racket-error-context variable, which defaults to 'low. Setting it to
> >>>> 'high uses errortrace.
> >>>>
> >>>> Also, you can have your cake and eat it, too. You can leave this set
> >>>> to 'low; that's used when you C-c C-c to racket-run. But with a prefix
> >>>> -- C-u C-c C-c -- it will run with errortrace. As a result, you can
> >>>> use a lower level normally for speed. But if/when you get a vague
> >>>> error message, you can re-run to get a better message.
> >>>>
> >>>> More info:
> >>>>
> >>>>
> https://github.com/greghendershott/racket-mode/blob/master/Reference.md#racket-error-context
> >>>>
> >>>>
> >>>> Personally, I usually run with 'high / errortrace all the time. I did
> >>>> however tweak the errortrace instrumentation to warn when I use `time`
> >>>> or `time-apply` -- so that I don't make stupid performance claims on
> >>>> the Racket mailing list. Er, I mean I added this for a friend who did
> >>>> that once. :)
> >>>
> >>>
> >
>

-- 
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/CAGxFmCMyrr-D6G2A4UJWZbwWyPK3f7s_A9DXx6JANGx%3DdqfuEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: snap-p.tgz
Description: GNU Zip compressed data

Reply via email to