
Starting to fell like it wasn’t all time lost, thanks :)

Livestream started! I’m listening to the setup while cleaning the bathroom!

will the racketcon stuff be uploaded to youtube :0?

yes - it is playing now on the racketlang channel


I’m also in the “being at racket con while doing housework” club

I like the racketmud idea

Can you use Rust with Racket FFI?

@spdegabrielle Rust exposes C-like ABI bindings iirc

Thank you @yilin.wei10

EDIT: Originally posted in beginner, but I think the question is too niche.
This is a bit of an niche question — suppose I have a C function which calls a Racket function multiple times and I want to get all the arguments which it has been called with (for the sake of argument, let’s call the function foo(int)
). If this was a Racket function I would use a continuation like this:
(define foo (lambda (%) (shift k (cons % (k '())))))
(displayln
(prompt
(foo 1)
(foo 1)))
However, this doesn’t work in the case that foo
is called within the C library — this isn’t entirely surprising and I hypothesized it had to do with the fact that the C ffi used the continuations to do the callbacks and it does indeed work when using prompt-at
as expected. Where in the C ffi code would I look to confirm the hypothesis?

Welp, Gather won’t stop crashing, so I guess it’s a Youtube exclusive for me this year. :shrug: Gonna miss seeing everyone this year!!

Also on an unrelated note, first-class continuations are awesome.

The C FFI doesn’t use first class continuations

But I think I don’t totally understand your question

Hmm; I’ll post the snippet of code to be concrete

(let ([prompt-tag
(make-continuation-prompt-tag)])
(call-with-continuation-prompt
(λ ()
(wl-registry-listen
registry
(λ (_ name interface version)
(shift-at prompt-tag k
(cons
(list name interface version)
(k '())))))
;; TODO: Probably use a different function — display roundtrip is really too powerful?
; 'wl-display-roundtrip' calls the registered Racket callback multiple times, returning
; the number of callbacks, but we want the data
(and (wl-display-roundtrip) '()))
prompt-tag))

Originally I simply used a prompt
and shift
which didn’t work

The functions prefixed with wl-
are C functions. I pass in a callback in wl-registry-listen

So I had assumed that it wasn’t working because the C-ffi was using the default prompt.

Does that make sense?

You can’t capture continuations across the FFI boundary

That’s why it doesn’t work

But it works when using a separate prompt (the snippet above works…)

?

Is this on Racket CS or BC?

Ah, I think it’s BC…

Then I wouldn’t have expected that to work

But maybe it does

(system-type 'vm) = 'racket
means BC right?

Right

Let me see if CS works as well

is there a download of the racket con live stream because on youtube its painfully slow…

watching on 144p also..

its not my banwidth

i guess eventually youtube will fix it

It’s streaming nicely for me

@jestarray I haven’t had any issues - it may have paused once or twice briefly.

i have no issues streaming it live but the new ones being stored in the youtube channel archive are slow atm

hi, can I use a syntax class as a contract on a macro?

I bet @michael.ballantyne knows!

#lang racket
(require (for-syntax racket/contract syntax/parse syntax/parse/experimental/reflect)
(for-meta 2 racket/base syntax/parse ))
(provide m)
; Option 1, allowing an arbitrary pattern:
(begin-for-syntax
(define-syntax syntax-parse/c
(syntax-parser
[(_ p)
#'(flat-named-contract '(syntax-parse/c p)
(syntax-parser [p #t] [_ #f]))])))
(define-syntax m
(contract
(-> (syntax-parse/c (_ e:string))
syntax?)
(lambda (stx) #'5)
'foo
'bar))
; Option 2, using a reified syntax class
(begin-for-syntax
(define (syntax-parse-arg/c cls)
(flat-named-contract `(syntax-parse-arg/c ,cls)
(syntax-parser [(_ (~reflect arg (cls))) #t] [_ #f]))))
(define-syntax m2
(contract
(-> (syntax-parse-arg/c (reify-syntax-class string))
syntax?)
(lambda (stx) #'5)
'foo
'bar))

WOW!!!

hey folks — I have a Typed Racket survey for everyone: https://tinyurl.com/typed-racket-survey
please take a few minutes to fill it out, even if you are brand new to Racket and/or Typed Racket thank you!