[plt-scheme] scribble examples and errors

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Aug 28 00:09:13 EDT 2009

This is currently hard-wired to the way it converts strings into
syntaxes.  It uses 'program for the given program and 'eval for later
interactions.

It's possible to bypass it in two ways:

1. Give it syntax values, so there is no need to read the strings,

2. Change the `sandbox-reader' function to one that uses it's own
   source, eg

     (parameterize ([sandbox-reader
                     (let ([old (sandbox-reader)])
                       (lambda (_) (old #f)))])
       (make-module-evaluator "#lang scheme (if 1)"))

   But when I do that I still see a "#f" in the syntax error.


On Aug 27, Matthew Flatt wrote:
> The "eval" comes from the sandbox, which reads terms to evaluate using
> `read-syntax' with the source 'eval. Maybe that should be configurable
> in the sandbox, so you could use #f to indicate no source? (Eli?)
> 
> At Wed, 26 Aug 2009 14:03:51 -0400, Ryan Culpepper wrote:
> > How can I eliminate the "eval:X:0:" prefix from the error message  
> > shown in scribble examples for syntax errors, while still showing the  
> > terms that caused the error?
> > 
> > For example, if I put this in my scribble file:
> > 
> >    @(examples (raise-syntax-error 'some-example "some message" #'x))
> > 
> > I get this in the output:
> > 
> >    Example:
> >      > (raise-syntax-error 'some-example "some message" #'x)
> >      eval:1:0: some-example: some message in: x
> > 
> > If I create an evaluator and set the 'error-print-source-location'  
> > parameter to #f within the evaluator, the prefix goes away but so do  
> > the terms:
> > 
> >    Example:
> >      > (raise-syntax-error 'some-example "some message" #'x)
> >      some-example: some message
> > 
> > Is there any way to get the following?
> > 
> >    Example:
> >      > (raise-syntax-error 'some-example "some message" #'x)
> >      some-example: some message in: x
> > 
> > Ryan
> > 
> > _________________________________________________
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.