@spall I’ve pushed some changes to generally improve performance on a Chez Scheme build with threads; I hope I didn’t break futures, and the changes may help with your example. To work around a gap in dependency checking, delete “racket/src/thread/compiled” before building.
@mflatt I grabbed the changes but not surprisingly they broke something in my code which I had implemented in a fast way that won’t work long term. I added unsafe-struct-cas! in a hacky way and think it is best to add it correctly now. I have added an ‘unsafe-struct*-cas!’ function to rumble/struct.ss but don’t know how to correctly access this function when writing racket/base code.
(struct example (f1 f2))
(define s1 (example 1 2))
(example-f1 s1)
(cas-example-f1! s1 1 2) ;; old new
How do I generate the struct accessors?
How about a struct*-cas!
form that takes a struct-type name, similar to struct-copy
: (struct*-cas! example s1 f1 1 2)
? You can implement it along similar lines to struct-copy
, using syntax-local-value
and racket/struct-info
library.