[plt-dev] scribble with gui

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jun 22 08:56:33 EDT 2009

At Fri, 19 Jun 2009 11:23:37 +0800, Chongkai Zhu wrote:
> I am writing a scribble document and part of the source code is:
> @(define my-eval
>    (call-with-trusted-sandbox-configuration
>     (lambda ()
>       (parameterize ((sandbox-output 'string)
>                      (sandbox-error-output 'string))
>         (make-evaluator 'scheme/base #:requires
>                         (list (if gui?
>                                   'scheme/gui/base
>                                   'scheme/base)))))))
> @examples[#:eval my-eval
>           #|code that relies on scheme/gui/base|#]
> @(kill-evaluator my-eval)
> I put the scrbl file into a .plt file, and then install it inside 
> DrScheme (which I assume will make gui available).
> But the generated doc suggests otherwise:
> The "@(define" part leaves nothing in the html file, which is right.
> The "@examples" part generates, after the input:
>   reference to an identifier before its definition:
>   image in module: 'program
> in red, which I assume is caused because 'scheme/gui/base is not 
> required. Is this a bug, or did I do something wrong?

`scheme/gui/base' is not available when setup-plt runs. The "Quick"
document works around that by having two modes controlled through an
environment variable: one where images are rendered to PNGs (to be run
when scheme/gui' is available), and another that just uses the PNGs (to
be used by setup-plt).

> More weirdly, after that the html file contains a line:
> #<void>
> It seems to be the result of "@(kill-evaluator", but shouldn't that not 
> be printed?

The `scribble/doc' and `scribble/manual' languages do not currently
ignore void results. Probably they should. Meanwhile, the `define' form
didn't generate output because `defines' are specially lifted out of a
document (i.e., it's not because `define' produces void).

Posted on the dev mailing list.