
I don’t know if it’s Racket or DrRacket, but ever since updating to 7.6, DrRacket is rather sporadically (but consistently), crashing on me. Usually ~2–3 times a day during heavy use. I haven’t yet noticed any pattern to the crashes. Just wondering if I’m the only one experiencing this?

Which OS?

Windows 10

To be clear, I’m not seeing any error messages either. It just hangs for a second or two and then closes the window.

I do a lot of FFI code, so usually I’d chalk something like this up to bad code on my part. But this is code that’s been running great on 7.5 for a while now.

@massung Try starting DrRacket from a terminal/console/command line (I have forgotten what’s the proper Windows term is these days).

The hope is that you will see some kind of helpful error message.

Will do. Thanks.

Is local-require
the right tool for implementing conditional (e.g. racket version dependent) require statements? It seems like it cannot be used in cases where one might want to re provide a form. Encountered while trying to come up with a way work around missing syntax/macro-testing
https://github.com/tgbugs/racket-mode/blob/eca68d57fcdbe044eea62a264834784ade3af865/racket/test/comments.rkt#L5\|here. Another way to phrase the question: how to correctly handle cases where a require form can fail?

@tgbugs Typically I’d use dynamic-require
. Especially when the condition is a binary provided-or-not, I don’t even pay attention to version numbers (because they’re just a proxy for the thing I actually care about: does mod
provide def
.)

For Racket Mode I also do thing like this: (define-simple-macro (define-polyfill (id:id arg:expr ...)
#:module mod:id
body:expr ...+)
(define id
(with-handlers ([exn:fail? (λ (_exn)
(λ (arg ...) body ...))])
(dynamic-require 'mod 'id))))
where example would be say: (define-polyfill (find-collection-dir str)
#:module find-collection/find-collection
(error 'find-collection-dir
"For this to work, you need to `raco pkg install raco-find-collection`"))
or (define-polyfill (path-replace-extension path ext)
#:module racket/path
(path-replace-suffix path ext))

Oh ha I just noticed from Travis CI this is re you doing a PR for Racket Mode. :smile: That little define-polyfill
macro is something I added very recently to Racket Mode only on the check-syntax
branch so you can’t use that for a PR targeting master
, yet. You could use with-handlers
and dynamic-require
directly. Also, as of check-syntax
branch I’m requiring Racket 6.5 or newer — if that’s simpler and you don’t mind waiting N weeks for your PR.

Fine to wait for the added simplicity.

Or just do the PR and I’m happy to figure it out.

The test in question is actually just me being extra paranoid, which I don’t have to be.

to be really sure that one
and two
are not bound

I can just remove that entirely if it is ok with you, and then it can probably go forward.

That seems fine. I’ll take a look at the PR and we can discuss more if necessary over there. Thanks for submitting!

quite welcome, I find if I have something in my head I might as well go ahead and finish it up

also, thank you for the answer, dynamic-require
seems like the correct answer

@mettinif has joined the channel