raykar.ath
2020-7-13 07:30:32

Hi, apologies if this sounds too vague, but I am getting this weird behaviour from the Racket web server.

I have put #:servlet-regexp #rx"" on my serv/servlet function call so that I can avoid seeing the default racket web server page and run my own dispatching function at the top level. But since yesterday I have started seeing the racket default server page again at the top level despite the empty regex. This started happening for all my applications that had the same empty regex keyword argument, including a minimal version I wrote as a test.

What seems to have fixed it is when I change the #:port from 8080 to any other number and it works. I checked that port using lsof to see if anything is already listening on that port, but there seems nothing there. This problem persists over reboots, and now I cannot use the port 8080 and be able to handle top level requests anymore. Am I missing something obvious here?

(to add a little more background, I started seeing the problem while trying to make serving static files work and tweaking the servlet-root-path and extra-files-path)


raykar.ath
2020-7-13 09:28:22

Well I am not sure what went wrong, but it seems to have resolved itself for now.


spdegabrielle
2020-7-13 09:45:27

Do some DrRacket user assume Racket is slow because it is not obvious that debugging is on?


alexharsanyi
2020-7-13 09:54:11

My guess is that many new users do not know or understand the difference between DrRacket, Racket and the Student Languages. So when a user complains that “Racket is slow”, this could mean several things: • DrRacket the IDE is slow to respond when typing code • The program they write takes to long to evaluate before they get to the prompt • This program might be written in Racket, Typed Racket or something else • They might use other libraries which might themselves be slow


soegaard2
2020-7-13 09:57:47

Sometimes the GUI feels slow compared to other editors.

Give https://www.sublimetext.com/ a spin. Open a large file. Try scrolling. Be amazed.


spdegabrielle
2020-7-13 11:28:44

how does it compare when you turn off background expansion? (good example the 5668 line file /drracket/drracket/private/unit.rkt)


spdegabrielle
2020-7-13 11:29:21

I consider that large for a code file.


soegaard2
2020-7-13 12:22:54

Try it!


spdegabrielle
2020-7-13 13:48:03

managed to crash drracket :disappointed:


spdegabrielle
2020-7-13 13:50:02

I turned off background expansion - no speed problems - if scrolled nicely with usign the scrollbar despite colourign comments, booleans and strings.


spdegabrielle
2020-7-13 13:56:04

my mistake - I did not crash DrRacket - I had and open 2htdp/universe window and pressing check syntax seemed to kill DrRacket, but in the time it took to write this, drracket actioned my attempt to close the open window 2htdp/universe and proceeded to play all the outstanding gui events. it now scrolls all 5668 lines of unit.rkt smoothly while drawing arrows etc. A LOT more is going on here than when SublimeText scrolls.


soegaard2
2020-7-13 13:57:41

Yes - it is a somewhat unfair comparison - SublimeText does not need to handle snips (nor arrows).


soegaard2
2020-7-13 13:59:21

But Alex talked about the impression new users get - and they don’t see the added layer of complexity.

Have you tried scrolling without using the scroll bar (using either a mouse scroll wheel or a two fingers on a touch pad)?


spdegabrielle
2020-7-13 13:59:55

Do any other IDEs do ‘Background Expansion’? Visual Studio, Xcode, intelliJ?


soegaard2
2020-7-13 14:01:05

I believe so - but it’s easier to fast in languages without macros.


soegaard2
2020-7-13 14:02:00

(I am interpreting “background expansion” as “resolving bindings of identifiers”).


tim986
2020-7-13 14:05:42

I just had a job interview that required a 15 minute presentation. I chose Slideshow over Google Slides or Keynote. Robust, slide-timers, clock, preview on one screen. Slideshow full screen on the other (although the system menu bar was still visible so not full screen) Thanks Slideshow People!


tim986
2020-7-13 14:09:04

Plus “Hermes Maia”. Thanks @mbutterick


tim986
2020-7-13 14:09:45

It looked good… :crossed_fingers: that the content was up to scratch!


spdegabrielle
2020-7-13 14:22:07

Git(Hub) question - If a reviewer suggests a change and the PR author accepts/applies the suggestion - is it OK for the PR author to mark it as resolved, or is the reviewer expected to check the change to the PR and close it if they are happy?


ruyvalle
2020-7-13 15:34:01

Where I work it is always the person who opens a discussion thread who closes it.


cuyler.jones
2020-7-13 15:42:45

@cuyler.jones has joined the channel


samth
2020-7-13 15:49:06

I think it depends whether the change definitely addresses the issue


gknauth
2020-7-13 21:08:09

I hope you get the job. Maybe Slideshow should implement a subliminal “Hire me!” message that displays for 1/60th of a second every so often, randomly.


jane.ola
2020-7-13 21:11:51

@jane.ola has joined the channel


n.gimenez66
2020-7-13 21:28:50

Hi! I am considering Racket to make a GUI that would be synchronized with a textual DSL. I am wondering whether such things have already been attempted in Racket? Besides, how does Racket desktop GUI abilities compare to what you can get from Electron, JavaFX or C++ Qt? Are there limitations in terms of styling and interactivity that I should be aware of? Thank you for your reply!


notjack
2020-7-13 22:03:19

Two-way sync between source code and a GUI is an active field of research, but I forget the keywords that would bring it up in search. I think @florence would know.


florence
2020-7-13 22:14:52

As to your second question, you want the racket/gui and framework libraries.

As for your first question, frtime is probably the closest to what you want? But im not sure i understand your goals so its hard to direct you better


n.gimenez66
2020-7-13 23:03:57

Thank you for your quick replies. As of the second question, I was wondering about the eventual limitations racket/GUI could have (in particular regarding styling) as opposed to more mainstream frameworks such as those mentioned above.

As of the first question, imagine a GUI with two panes, a text editor with a source code written in some custom racket DSL on one side, and on the other side a bunch of widgets (windows, boxes with text, shapes etc). I want that any change in the widgets automatically modify the source code in the text editor, and the other way around. This way, both are in sync. A little bit like what you observe with Jetbrains MPS but without the constraint of not having a real textual DSL.


alexharsanyi
2020-7-13 23:13:13

@spdegabrielle, I think “background expansion” is a Racket specific term, so in a very strict sense, no other IDE does it, except racket-mode.

However, a lot of IDEs provide similar features, such as highlighting errors as you type code, providing completion assistance showing where an identifier is defined and all the place where it is used.

Also, the way that DrRacket does these things is unique to DrRacket. For example, no other IDE that I’m aware of will draw arrows to show where something is used, but most of them will show you where something is used via other means.

In terms of features, everything DrRacket provides, other IDEs also provide for their respective languages.


samth
2020-7-13 23:28:33

Additionally, Rust IDEs do basically exactly background expansion, or some way of approximating it, because Rust has similar macros to Racket.


samth
2020-7-13 23:29:09

(They approximate because they don’t want to treat expansion as arbitrary computation because that’s both slow and reduces their ability to do thing incrementally)


notjack
2020-7-13 23:45:08

Found the thing I was thinking of. The thing you’re describing is very similar to Sketch-n-Sketch https://www.youtube.com/watch?v=YuGVC8VqXz0&app=desktop\|https://www.youtube.com/watch?v=YuGVC8VqXz0&app=desktop


notjack
2020-7-13 23:45:43

“direct manipulation” is the technical term I’ve seen used to describe this kind of editor interface


n.gimenez66
2020-7-13 23:54:09

Awesome, thank you!


jcoo092
2020-7-14 00:00:45

I’ll put it this way: I have no idea what you mean by “background expansion”, and I have at various times used Visual Studio, XCode and IntelliJ, so if they do it, they don’t use that name for it :slightly_smiling_face: (or, at least, it’s not something they talk about much)


samth
2020-7-14 00:01:44

They don’t use that name, because they don’t have macros, but they certainly parse and type check the file as you type


jcoo092
2020-7-14 00:03:08

Yip, that’s definitely true.


samth
2020-7-14 00:04:04

In Racket, “parsing” and “type checking” are just part of expansion, plus expansion can do a lot more


samth
2020-7-14 00:05:04

Any C++ IDE does expansion of CPP macros in a background thread, it just happens that no one gives a name to that part of the system


erhlee.bird
2020-7-14 00:55:00

@erhlee.bird has joined the channel


erhlee.bird
2020-7-14 01:20:01

is there a way to call a macro with a list as its arguments

something like the following is the idea (require brag/support) ; XXX: I have other parts of the code base that I would like to share the reserved terms with ; As the :or macro stands, it only takes in arguments and not a list (define-lex-abbrev reserved (:or "begin" "if" "then" "end")) (define reserved-terms '("begin" "if" "then" "end")) (define-lex-abbrev reserved (apply :or reserved-terms))


sorawee
2020-7-14 01:26:13

Can you share “other parts of the code base” that will use reserved-terms?


erhlee.bird
2020-7-14 01:31:34

I have 2 pieces

• reader based on beautiful racket (source -> s-expr) #lang brag program : lines* line : RESERVED INTEGER #lang racket (require brag/support) (define-lex-abbrev reserved-terms (:or "begin" "if" "then" "end")) • compiler using #nanopass (ast passes over a well-defined s-expr) #lang nanopass (define (reserved? x) (memq x reserved-terms)) they both represent the same grammar in slightly different ways and the particular list of reserved-terms that I have is really long


sorawee
2020-7-14 01:43:08

One possibility is writing a macro to duplicate the reserved terms. Something like this:

(define-syntax-rule (define-reserved-terms (lex-abbrev-id regular-id) terms ...) (begin (define-lex-abbrev lex-abbrev-id (:or terms ...)) (define regular-id (list terms ...)))) (define-reserved-terms (reserved-term-class reserved-terms) "begin" "if" "then" "end")


sorawee
2020-7-14 01:43:59

then you can use reserved-term-class in lexer, and use reserved-terms as a regular variable.


erhlee.bird
2020-7-14 01:58:58

awesome, that works perfectly for me thanks @sorawee