
@perry.houchens has joined the channel

How to typeset a module example that ends in an error? I’ve been trying scribble/example
but it seems like it’ll either do a module or an error — not both.
This is the closest module-looking thing I’ve got: #lang scribble/manual
@(require scribble/example)
@title{Sample}
@examples[#:eval (make-base-eval) #:no-prompt #:no-inset
(code:comment "#lang racket/base")
(define x 42)
(eval:error (string-length x))
]

The form examples
has a #:lang
option.

The lang option disables (eval:error ...)
but, I just realized, #:lang
also ignores indentation. So I’ll probably keep what I have.

Oh. I see what you mean. Do you think it is intentional, that eval:error
is disabled?

It seems strange, but also old. Maybe there was never a need to implement eval:error
for modules.

The examples form that suppress errors use variants of interaction
. https://github.com/racket/scribble/blob/beb2d9834169665121d34b5f3195ddf252c3c998/scribble-lib/scribble/example.rkt#L26

When the #:lang
option is present, examples
use racketmod+eval.
[(attribute module-name)
(syntax/loc stx
(racketmod+eval #:eval eval #:escape escape module-name
form ...))]

The problem is the "+eval" :slightly_smiling_face:

Here is the definition of racketmod+eval
: (define-syntax racketmod+eval
(syntax-rules ()
[(_ #:eval ev #:escape unsyntax-id name e ...)
(let ([eva ev])
(#%expression
(begin (interaction-eval #:eval eva e ...)
(racketmod #:escape unsyntax-id name e ...))))]
[(_ #:eval ev name e ...)
(racketmod+eval #:eval ev #:escape unsyntax name e ...)]
[(_ #:escape unsyntax-id name e ...)
(racketmod+eval #:eval (make-base-eval) #:escape unsyntax-id name e ...)]
[(_ name e ...)
(racketmod+eval #:eval (make-base-eval) #:escape unsyntax name e ...)]))
```Maybe a variant that uses
(interaction #:no-errors? #t #:eval eva e ...)
is the answer?```

Or use interaction
and rackemod
directly.

it’s turtles all the way down

turtles = macros confirmed

@popa.bogdanp This test failure https://pkg-build.racket-lang.org/server/built/test-fail/dbg-ui.txt is because the test
submodule in dbg-ui/ui/reference-graph.rkt
launches a window and doesn’t close it. It seems like it might make sense for that to be the main
module instead.

@ben This is pretty close: #lang scribble/manual
@(require scribble/example
(only-in scribble/eval interaction/no-prompt))
@title{Sample}
@(define ev (make-base-eval))
@(begin
(racketmod #:escape code:error racket/base
(define x 42))
(interaction/no-prompt #:eval ev #:no-errors? #t
(eval:error (string-length x))))

:+1: much better!

I am not sure how to get rid of the extra indentation of (string-length x).

Oh! The error is wrong now.

@(begin
(racketmod #:escape code:error racket/base
(define x 42))
(interaction-eval #:eval ev (define x 42))
(interaction/no-prompt #:eval ev #:no-errors? #t
(eval:error (string-length x))))

(interaction/no-prompt #:eval ev (string-length x))
gets rid of the indentation (I wonder if that’s a bug in eval:error … ignoring the no-prompt setting)

I think so. Not in the datum eval:error though, but in interaction/no-prompt.

Thanks! Fixed.

@pavpanchekha can I encourage you to restructure egg-herbie-{windows,linux,osx}
so that they don’t conflict on the pkg-build?

Hi Sam, we’d love to. Would you be willing to do a meeting with the Herbie devs to tell us how to do it better? We’re in the middle of wanting to change this up.