massung
2020-3-1 13:56:00

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?


soegaard2
2020-3-1 14:21:45

Which OS?


massung
2020-3-1 16:23:03

Windows 10


massung
2020-3-1 16:23:33

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


massung
2020-3-1 16:25:28

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.


soegaard2
2020-3-1 16:54:35

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


soegaard2
2020-3-1 16:55:05

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


massung
2020-3-1 16:55:16

Will do. Thanks.


tgbugs
2020-3-2 00:58:33

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?


greg
2020-3-2 01:27:41

@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.)


greg
2020-3-2 01:30:11

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))


greg
2020-3-2 01:37:14

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.


tgbugs
2020-3-2 01:38:33

Fine to wait for the added simplicity.


greg
2020-3-2 01:38:36

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


tgbugs
2020-3-2 01:39:16

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


tgbugs
2020-3-2 01:39:28

to be really sure that one and two are not bound


tgbugs
2020-3-2 01:39:55

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


greg
2020-3-2 01:40:44

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


tgbugs
2020-3-2 01:41:22

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


tgbugs
2020-3-2 01:47:58

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


mettinif
2020-3-2 03:50:38

@mettinif has joined the channel