I was at Racketfest. :metal:
@jesse Racketfest!
:slightly_smiling_face:
I’m preparing the Racketfest videos and proceedings — stay tuned!
Awesome! :slightly_smiling_face: Thanks for that.
I’ve got 4.5 gigabytes of Shriram
That’s definitely lots of Shriram bytes!
Ok you were right. Passing a class through #’(my-class-name) seems to actually pass the whole identifier down phase levels. I was expecting something like “my-class-name is not bound to a class”, but it seems to work.
Maybe there’s something about begin-for-syntax
I don’t understand. I would have thought the scope of a begin-for-syntax
would prevent other phases from accessing the classes defined there. Does #'
work as a closure?
is there a standard way to have a cut inside a syntax class be treated as a cut for the pattern that uses the class
@gfb Yes, use #:no-delimit-cut.
@lexi.lambda Thanks! Maybe that should be mentioned under the description of ~!
, which mentions syntax classes but not that option (which is probably why I didn’t look carefully enough in the syntax-class section).
@greg for some reason I’m finding that call/input-request in the http package is really slow — has something changed? I’m on 7.2.
wait, nevermind — I’m using port->bytes as part of my entity reader, and this is somehow the bottleneck.
@alama if there’s something wrong (or even suboptimal) in port->bytes
let me know
it’s my mistake, no error in either @greg’s stuff or port->bytes
— I was being dumb and unboundedly reading an open HTTP connection
very silly error on my part. presumably the remote HTTP server was cutting me (that is, the open connection) off after one minute (the amount of time port->bytes
was taking)
aha
btw, sounds like RacketFest was great!
yeah! it was a blast. a ton of people showed up (65 registered, about 55 actually came), coming from many perspectives. I’d say only a handful of the people were major/serious Racket programmers. Most were enthusiasts of one kind or another and had dabbled with the language to varying degrees.
The scope of a begin-for-syntax
? Identifiers defined inside a begin-for-syntax
are available in all other phase 1 code that has those scopes.
This includes: - Other begin-for-syntax
things in that module - Macro transformer expressions in define-syntax
, let-syntax
, etc. in that module - Macro templates in that module that might get inserted into phase–1 positions in any module, including other modules
This isn’t about crossing phases. I’m guessing the way you’re using it, the identifier is being put into a phase–1 position in the other module, and that’s fine, supported by macro hygiene.
I guess my case is the third one. I’m putting the syntax-class in a template, moved through provide into other modules.
And when it gets moved into other modules it retains the scopes from the macro-definition site in the original module, so the non-provided syntax class in the begin-for-syntax
will be available as long as you insert it into the same phase.
@wlbberman has joined the channel
I see, thanks for the explanation!
Is there any way to do the equivalent of exec
in Racket, i.e. replace the current process with a new one? I suppose I could always just call execv
via the FFI, but I’d rather not have to.
Try this. Open DrRacket. Type a little. Minimize the window (macOS). Switch to another program, then switch back to DrRacket.
Now I see “DrRacket”, “File” and “Help” menus in the menu bar.
Alas the “Window” menu is gone.
So how can I choose the window I minimized?
@soegaard2 is it not in the dock?
No, there’s no equivalent to exec
.
I hope I’m missing something simple here, but I’m trying to write a macro that expands to class
, declares an lexically-scoped initialization argument, and lets the body forms refer to it via a syntax parameter. Some ways that don’t work: (define-syntax-parameter arg #f)
(let ()
(define-local-member-name lexical)
(syntax-parameterize ([arg (make-rename-transformer
#'lexical)])
(class object%
(super-new)
(init [lexical 1])
(printf arg))))
;; lexical: unbound local member name
(define-syntax-parameter arg #f)
(let ()
(define-local-member-name lexical)
(class object%
(super-new)
(init [lexical 1])
(splicing-syntax-parameterize ([arg (make-rename-transformer
#'lexical)])
(printf arg))))
;; identifier used out of context: lexical
(define-syntax-parameter arg #f)
(let ()
(define-local-member-name lexical)
(class object%
(super-new)
(init [(internal-name lexical) 1])
(splicing-syntax-parameterize ([arg (make-rename-transformer
#'internal-name)])
(printf arg))))
;; identifier used out of context: internal-name