aymano.osman
2020-2-7 10:16:56

How do I install it?


massung
2020-2-7 14:23:00

Is there a particular exception that’s thrown to running code if the “Run” or “Stop” buttons are pressed in DrRacket while a script is currently running that I could catch (in the running script) so it terminates nicely?


soegaard2
2020-2-7 14:39:34

I think “stop” sends a “break”.




massung
2020-2-7 14:55:06

ty


massung
2020-2-7 14:58:10

ok, catching the break is easy enough, but still not sure how to handle Run. It doesn’t seem to throw any exceptions.


soegaard2
2020-2-7 14:59:51

I don’t think the run button does anything if the your program is running already?


massung
2020-2-7 15:05:46

well, for example, if I run a script that opens a frame. I make some code changes, click ‘run’ and the frame goes away, it recompiles and re-launches the frame. I’m opening an OpenGL window and I’d like the same behavior. But, instead, when I click run the GL window stays open and becomes unresponsive and the code controlling it is no longer running. Then a new GL window opens up with the new code active


massung
2020-2-7 15:07:33

I’m imagining that - like exn:break - I can catch something and terminate gracefully, but I’m not finding that clicking “run” does anything I can break on


greg
2020-2-7 15:11:49

So in this situation, where the module-path-index of a module doesn’t yet have a name, and (resolved-module-path-name (module-path-index-resolve mpi)) is '\|expanded module\|? In Rackets older than 7.0, if I try to check for that using eq?, that symbol is not eq? to my own literal '\|expanded module\|. :eyes: I have to check via something like (equal? (symbol->string sym) "expanded module"). e.g. If I do this in Racket 6.5.


greg
2020-2-7 15:12:58

That’s older versions of Racket, pre 7.0, and I am happy to use the pragmatic work-around I just mentioned, and the slower compare won’t matter in this context. And I don’t want to go down a rabbit hole. But part of me wants to know the answer to this WAT.


greg
2020-2-7 15:13:33

So @mflatt if you happen to know, or have a quick guess, I’d love to know. But you’re busy and it really doesn’t matter so I don’t want to distract you for more than 5 seconds. :smile:


greg
2020-2-7 15:14:30

Again, in newer Rackets 7.0 the symbol is simply eq? as expected. I just try to keep Racket Mode working with older Rackets until it’s impractical.


mflatt
2020-2-7 15:15:53

To detect “the current module,” it’s better to detect that module-path-index-split returns two #fs than to look for a specific symbol. Is that workable in your context?


mflatt
2020-2-7 15:16:53

I don’t remember whether it was important that the way '\|expanded module\| is picked changed in the new expander.


mflatt
2020-2-7 15:20:18

There’s no exception-like signal for a custodian-based shutdown (which is what the Run button does). But at the ffi/unsafe level, you can register custodian shutdown operations. See ffi/unsafe/custodian.


massung
2020-2-7 15:20:57

ty sir


greg
2020-2-7 15:21:43

I felt the same way and switched to using module-path-index-split -> #f #f for awhile — but it turned out to match other situations. i.e. There are “self” modules for more than just the expanded module case.


greg
2020-2-7 15:22:28

If that tickles you as weird or wrong I can try to dig up the details from a couple days ago.


greg
2020-2-7 15:23:19

(As for the old versions, I was just surprised that two symbols could be not eq? when symbol->string of each is equal.)


mflatt
2020-2-7 15:25:45

The symbols aren’t eq? because one of them is uninterned. I am interested in the details on how you ended up withe multiple “self” MPIs.


greg
2020-2-7 15:28:28

Oh. Interning. I “knew” about that, but it’s never mattered in so many years of Racket programming, I forgot about that. Thanks!


greg
2020-2-7 15:30:09

I’ll rewind in the git history and try to dig up an example for the “self” #f #f that’s not a expanded-but-not-evaluated module and let you know….


greg
2020-2-7 15:56:36

@mflatt OK here it is. When current-namespace is from module->namespace, and, you do something like (identifier-binding (namespace-symbol->identifier 'some-id-defined-in-that-module)) — then the mpi’s are '(#<module-path-index:()> describe #<module-path-index:()> describe 0 0 0).


greg
2020-2-7 16:01:22

Having said that, I think I can use the self-module? test combined with another test, to avoid the business of matching on the '\|expanded module\| symbol. I agree the latter seems smelly, which is why I tried to move away from it. I just need to try harder. :slightly_smiling_face:


greg
2020-2-7 19:38:03

@aymano.osman It’s not quite ready to install unless you’re brave like @popa.bogdanp. Hopefully a few more days.


greg
2020-2-7 19:40:24

So if you replace '\|expanded module\| someday with '\|the module that shall not yet be named\| or 'voldemort I should be :ok_hand:


greg
2020-2-7 19:43:33

I want to ask folks for some Friday pick-a-name bike-shedding but will put that in a thread below this. :smile:


greg
2020-2-7 19:43:55

“racket-check-syntax-mode” is too long. “racket-check-syntax-” is too long a prefix for names of commands for users. (Not to mention in source code. Although I’ve already done all that typing, I could make it better for future typing and reading).


greg
2020-2-7 19:44:21

Also, “checking syntax” isn’t really the full scope. Really, it’s about “static analysis” of expanded-but-not-evaluated module forms. Sure, if there is a syntax error, you get a message. But the bulk of of the benefit is what you get when there is not a syntax error: Rich information about bindings, imports, and more. This enables you to explore and navigate code, understand the use (or non-use) of bindings, rename bindings, and more.


greg
2020-2-7 19:44:59

So what would a better name be?

Something to do with: - analyze - annotate - expand - explore - explicate


greg
2020-2-7 19:45:16

Maybe racket-an-mode — i.e. an{alyze notate} ?? Meh.


greg
2020-2-7 19:45:30

Maybe racket-exp-mode — i.e. exp{and lore licate} ?? Better?


greg
2020-2-7 19:45:42

Or racket-xp-mode ?? Better?


greg
2020-2-7 19:45:59

To force Slack to do a “poll” I’ll put a little reaction next to each of those, you can click to +1. Write-in candidates also welcome.


notjack
2020-2-7 20:15:24

can these names be autocompleted? (I don’t know anything about emacs)


greg
2020-2-7 20:18:32

Yes, autocompleted, and bound to keys. Even so, a bad name is bad, and a long name is long. :smile: Seriously it doesn’t help when writing Emacs Lisp to have identifiers like noise-noise-noise-noise-signal. Or reading documentation about Racket Mode. etc.


greg
2020-2-7 20:20:04

“To customize how blah-blah-blah-blah-blah-mode shows this, change blah-blah-blah-blah-blah-face to…” and so on. :slightly_smiling_face:


abmclin
2020-2-8 02:37:43

How about abbreviating racket? rkt-analysis-mode


abmclin
2020-2-8 02:38:54

I figure if somebody is going to use such a mode probably already knows *.rkt files pretty well


leif
2020-2-8 04:16:33

The OO system has object-method-arity-includes? which mirrors procedure-arity-includes?, so is there also an an analog for procedure-keywords? That is, is there any way to dynamically determine the keywords a method takes?