badkins
2021-8-24 14:52:14

I typically develop in Emacs, but I’m exploring some DrRacket features. When I right-click a function invocation, I see an option to open the defining file, but if DrRacket knows the defining file, can’t it also jump to the definition in that file?


sorawee
2021-8-24 14:53:28

It can, but you need to open the file first


sorawee
2021-8-24 14:54:16

That is, at first, the menu item is “open the defining file”

After you open the file, the menu item will be changed to “jump to definition”


badkins
2021-8-24 14:54:36

I’m sorry, but I don’t understand that limitation. DrRacket knows the file to open, and it knows the symbol to jump to in that file.


badkins
2021-8-24 14:55:16

Also, the menu didn’t change for me, even after opening the file.


sorawee
2021-8-24 14:56:05

As for why it can’t do that at once… it’s a good question. To quote @robby :

> It doesn’t do that because it takes (potentially a lot) of time to find the definition. So it jumps to the definition only when it already knows where the definition is. https://github.com/racket/drracket/issues/273


badkins
2021-8-24 14:56:11

Now, if I 1) open the defining file, and then 2) click “Check Syntax”, then the menu changes, but I’m trying to avoid work here :)


sorawee
2021-8-24 14:58:08

I think if you have background expansion enabled, you shouldn’t need to separately click Check Syntax


badkins
2021-8-24 14:58:36

No idea why it would take so long as to be a concern, what types of files are they worried about? Or, alternatively, how slow is this process of finding the definition? So many questions …


badkins
2021-8-24 14:59:32

Regardless, it’s a 2+ year old issue, so I guess there’s not huge demand.


samth
2021-8-24 14:59:35

it can take several seconds


samth
2021-8-24 14:59:54

or, for Typed Racket, significantly longer than that


badkins
2021-8-24 15:00:17

Will it take longer than the user doing it manually ?!?!


sorawee
2021-8-24 15:01:19

Yeah, I think it should be supported regardless of how long it takes, too. User doing it manually is always gonna be worse.


samth
2021-8-24 15:01:28

The concern is that the user experience would not be great — you select the menu item, and then the file opens and you wait some indetermiate amount of time and then it scrolls


badkins
2021-8-24 15:02:18

@samth - that last part confuses me, unless were talking about GB sized files


samth
2021-8-24 15:03:49

Also, I think racket-mode approximates things by looking at the surface syntax for things that look like definitions, and Robby has been reluctant to do that for DrRacket


robby
2021-8-24 15:07:00

To be clear, it has to expand the entire file to find it.


robby
2021-8-24 15:07:11

This can take significant time.


robby
2021-8-24 15:07:28

Much more than is acceptable to wait for a menu item response


robby
2021-8-24 15:07:38

There is some hope I will be able to improve this eventually.


seanbunderwood
2021-8-24 15:07:39

I’m on an 8 year old computer, and I have UX problems like that with KB-sized files.


robby
2021-8-24 15:07:43

Not today tho. :)


robby
2021-8-24 15:08:03

@seanbunderwood I will try not to make them worse.


samth
2021-8-24 15:11:00

Personally I find the racket-mode experience nice, where it does jump to the definition in the other file via a combination of waiting and heuristics (maybe @greg can say more?) but I understand that other people preferring other approaches.


greg
2021-8-24 15:14:53

Racket Mode also needs to fully expand the file. Its “trick” is that it uses a cache of fully-expanded syntax, and, sometimes the other file will already be in that cache.


seanbunderwood
2021-8-24 15:15:06

Perhaps it’s good to have a selection of different tools that take different approaches.


greg
2021-8-24 15:15:09

Robby has an idea about a sqlite db of fully-expanded syntax.


greg
2021-8-24 15:15:27

If/when that became real, Dr Racket (and Racket Mode) could use that to improve jump-to-def.


greg
2021-8-24 15:16:12

Also I’ve been experimenting with a sqlite db of check-syntax results. To support stuff like “find references” (the “opposite” of jump to def) as well as multi-file renaming.


greg
2021-8-24 15:16:19

But that’s still WIP.


badkins
2021-8-24 15:42:37

Wow, I’ve been lazy about leveling up with racket-mode - there’s some really nice features there!


badkins
2021-8-24 15:42:59

Quick question, when you “run” a file in the REPL in racket mode, it doesn’t run the main module, right?


badkins
2021-8-24 15:43:50

I have quite a few files in my project that have a (module+ main ... that should not be run except in very special circumstances :-o


greg
2021-8-24 15:44:11

C-c C-c is bound to`https://www.racket-mode.com/#racket_002drun_002dmodule_002dat_002dpoint which runs and “enters” the module around point.


greg
2021-8-24 15:44:45

However F5 does https://www.racket-mode.com/#racket_002drun which is more like Dr Racket


badkins
2021-8-24 15:45:18

I was referring to what happens when I hit M-. and it asks to “run” the file and try again. I put some invalid code in my main, and it didn’t seem to fire, so I assume that doesn’t actually run it.


greg
2021-8-24 15:45:28

Of course its Emacs those are the default keybindings but you can change :slightly_smiling_face:


greg
2021-8-24 15:46:00

The thing where M-. would ask to “run” the file again sounds like a quite old version of Racket Mode.


greg
2021-8-24 15:46:24

These days you’d probably use the minor mode racket-xp-mode, and it would be able to go right away.


badkins
2021-8-24 15:46:39

Yes, it also fails to “save for future sessions” in customize - I’ll go update now. Melpa confuses me, can I do this the old fashioned way by plopping a directory ?


greg
2021-8-24 15:47:15

Usually in Emacs to upgrade a melpa package I just package-delete it and package-install it again


badkins
2021-8-24 15:47:21

I guess the important question is whether some of my files with a main module will be accidentally run - maybe I should just comment them out for now.


greg
2021-8-24 15:48:11

I actually have to go now, someone waiting for me!, but I can check back later and hopefully that web page with the Racket Mode docs can help you in the meantime — cheers!


badkins
2021-8-24 15:49:13

Thanks!


ben.knoble
2021-8-24 16:26:54

Vim + racket langserver has been able to get this correct for me with no trouble, for the record


robby
2021-8-24 17:14:16

@badkins drracket does not run any program unless you click the run button. It will expand them when you open them (but it will disable filesystem access (except for reading for requires) and network access, etc).


robby
2021-8-24 17:14:39

oh, sorry. I see those were racket mode questions. Sorry!


jestarray
2021-8-24 17:23:06

am i the only one using racket lang server + vscode? seems like the lot of you are on emacs and vim (i only use vim for quick edits when im on the command line)


shu--hung
2021-8-24 20:33:36

I’m using1 both DrRacket and vscode + racket-langserv


badkins
2021-8-24 21:04:19

Hmm… I deleted racket-mode from my Emacs packages, so I could reinstall it, but now it’s no longer in the list. I’ve refreshed the package list, but it’s still missing. Anyone know how to get it back in the list so I can reinstall it?


badkins
2021-8-24 21:08:50

<sigh> and everytime I do something with melpa, I lose my colors config


badkins
2021-8-24 21:16:42

Changing the ’package-archives to conform to the latest racket-mode docs seems to have brought racket-mode back, so problem solved at the moment.


badkins
2021-8-24 21:45:25

yay, everything is working now, which begs the question, “why, oh why, did I wait so long to get racket-mode properly configured” ! @greg this is going to be a big boost to my productivity - do you have a donation page setup anywhere?


badkins
2021-8-24 21:50:28

badkins
2021-8-24 21:53:57

Hmm… doesn’t look like github allows entering a custom amount - I was looking for something between the $5 and $50 tiers.


jmhimara
2021-8-25 03:06:23

I’m having a bit of a hard time understanding the difference between standard vectors and arrays (from the math library). It says in the docs that vectors are constant time access and updates, whereas arrays seem a lot more complicated. Is there an advantage to using arrays over vectors?


shu--hung
2021-8-25 04:03:45

As I see from the doc, vectors are only 1D and have no special account for multidimensional creation, accessing, transformation and slicing. Whats more, vectors have arbitrary & irregular shapes