anything
2021-1-5 10:55:54

When I see an exception like this, it doesn’t seem easy to identify which exception this is. How can I catch it? I suppose it’s some kind of exn:fail? and most likely file system related. draft.rkt> (average game-round 1000) exception raised by error display handler: flush-output: output port is closed; original exception raised: display: output port is closed


anything
2021-1-5 11:04:31

Another question I have is how I could take (current-output-port) and connect it, say, to /dev/null. (My objective is to ignore the io transfers.) I’m on Windows, though. I don’t have /dev/null. I’d like all bytes that go to (current-output-port) to just be ignored, so I see no effect of applications such as (displayln …). (I tried closing the current-output-port, but that doesn’t seem the best thing to do here.)


anything
2021-1-5 11:07:42

My best solution has been to tuck it away in a string. (let ([dev-null (open-output-string)]) (parameterize ([current-output-port dev-null]) (proc (watch-game (new-game seed)))))



sorawee
2021-1-5 11:21:23

Well, it looks like you change error-display-handler and it’s buggy. error-display-handler is used for error reporting, so that’s the best it can do


samdphillips
2021-1-5 16:09:41

Aside from the issue that sorawee raised, a lot of the time it isn’t clear what exn? is being raised. If I can recreate the error conditions I will make some mock code like (with-handlers ([exn? displayln]) (something-that-makes-the-error))


samdphillips
2021-1-5 16:09:49

and see what comes out


anything
2021-1-5 16:11:04

Thanks. That’s helpful.


aymano.osman
2021-1-5 23:44:48

It looks like typed/racket does not support “generic interfaces” for structs. How do I keep up-to-date on development in that area?