[racket] using scribble's evaluator for planet packages

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Jun 15 17:44:32 EDT 2011

An hour and a half ago, Carl Eastlund wrote:
> Why does Scribble make this assumption about sandboxes, anyway?  Why
> can't it just deal with the other possible output formats
> intelligently?  Read from the port if given one, use a (byte-)string
> if given one, and just assume no output if given #f.

It could certainly take a `#f' as assuming no output -- but that's
very likely still a bug, since it means that potential output goes to
`current-output-port', probably mixed with the scribble compilation

It could also read output from a ports, but that can be a problem if
the sandbox was setup to put both outputs in the same port, leading to
a dependency on whether the code checks the supposed output first or
the error output first.  But even if this is somehow desired, pulling
out the available string from such an output port would be doing what
the sandbox is doing, so there's no point in that.

> If, for some reason, the best we can do is improve the error
> message, how about reporting it in terms of the Scribble forms we're
> actually using:
>   "examples: cannot read output of given evaluator, expected a string
> but got: #f"

That would involve changing more than I'm comfortable with in that
file.  For example,

  - `interaction' is a macro that expands to `interaction0',

  - which is a macro that expands to `titled-interaction',

  - which is a macro that expands to `do-titled-interaction',

  - which is a function that
    - calls `do-eval' to do the evaluation and get the resulting
      values and outputs
    - and then calls the `interleave' function
      - which calls `format-output' to show the two outputs.
        (which is where I put the check)

So 'interaction should be threaded through all of that to get that
error message, and checking whether any of these are also part of the
known interface and in that case have internal versions with the
additional argument.

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

Posted on the users mailing list.