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)
Well I am not sure what went wrong, but it seems to have resolved itself for now.
Do some DrRacket user assume Racket is slow because it is not obvious that debugging is on?
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
Sometimes the GUI feels slow compared to other editors.
Give https://www.sublimetext.com/ a spin. Open a large file. Try scrolling. Be amazed.
how does it compare when you turn off background expansion? (good example the 5668 line file /drracket/drracket/private/unit.rkt
)
I consider that large for a code file.
Try it!
managed to crash drracket :disappointed:
I turned off background expansion - no speed problems - if scrolled nicely with usign the scrollbar despite colourign comments, booleans and strings.
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.
Yes - it is a somewhat unfair comparison - SublimeText does not need to handle snips (nor arrows).
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)?
Do any other IDEs do ‘Background Expansion’? Visual Studio, Xcode, intelliJ?
I believe so - but it’s easier to fast in languages without macros.
(I am interpreting “background expansion” as “resolving bindings of identifiers”).
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!
Plus “Hermes Maia”. Thanks @mbutterick
It looked good… :crossed_fingers: that the content was up to scratch!
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?
Where I work it is always the person who opens a discussion thread who closes it.
@cuyler.jones has joined the channel
I think it depends whether the change definitely addresses the issue
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 has joined the channel
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!
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.
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
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.
@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.
Additionally, Rust IDEs do basically exactly background expansion, or some way of approximating it, because Rust has similar macros to Racket.
(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)
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
“direct manipulation” is the technical term I’ve seen used to describe this kind of editor interface
Awesome, thank you!
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)
They don’t use that name, because they don’t have macros, but they certainly parse and type check the file as you type
Yip, that’s definitely true.
In Racket, “parsing” and “type checking” are just part of expansion, plus expansion can do a lot more
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 has joined the channel
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))
Can you share “other parts of the code base” that will use reserved-terms
?
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
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")
then you can use reserved-term-class
in lexer, and use reserved-terms
as a regular variable.
awesome, that works perfectly for me thanks @sorawee