IRC channel logs
2024-05-25.log
back to list of logs
<cpli>i can't quite grasp at a solution that calls (poll-coop-repl-server server) reliably, but i don't want to resort to an arbitrary timer in the foreign event loop <cpli>daviid let's assume i am, theoretically i think i could somehow poll the foreign descriptors and event sockets in my own event loop, but i know from experience that this foreign one is neat. <cpli>polling arbitrarily makes me uncomfortable, can i not select on the clients at all daviid? <cpli>even if i have my own event loop - using fibers or guile-a-sync3 - am i not just forced to call (poll-coop-repl-server server) repeatedly, every n ms? <cpli>david: sure, let's use github:wingo/fibers. now: i only want to call (poll-coop-repl-server server) *when* there's something to evaluate. how could i do that? <daviid>cpli: i'll let experts answer you, not my domain, but i wanted to suggest fibers and guile-a-sync3, and avoid C as much as possible - fwiw chickadee also has a coop-repl-server iirc, there is also the 8sync lib https://www.gnu.org/software/8sync/ ... so, it should be possible to avoid to reinvent and rewrite the wheel here, i think <Kolev>ArneBab, I am having trouble using Wisp. <Kolev>ArneBab, I just want to convert my Lisp code to Wisp. <daviid>cpli: not a maintainer, but i think fibers will land in core guile, sometime in the future - for a very flexible definition of future ... <cpli>daviid: i don't know how useful "avoid c" is when in the next moment you bring up that chickadee also contains `coop-repl-server`, dynamically links a dozen c libraries, and calls `coop-repl-server` every frame (which i do too, in another application) <cpli>also linking to more (in the case of bitrotten 8sync) guile async implementations, is not just unhelpful when there's a concrete problem that you yourself say you don't understand, it's outright inconsiderate <cpli>i'm not rewriting the wheel (the coop-server), the wheel is there, just the axle doesn't fit <daviid>cpli: it is always useful to avoid C, Fibers would be my first choice, the guile-a-sync3 (i mentionned the others for info ...) - there are quie a few fibers experts here, so if the answer to your specific quiz is not in the fibers manual, nor in any examples 'out there', just ask for help and be patient ... <cpli>daviid, it was a race condition <cpli>otherwise my approach works <cpli>for some definition `(define (f x) (define (g x) (+ 3 x)) (g x))` is it possible to override `g` at call-site? <cpli>yeah, i expected as much. rlb <cpli>this means, that if you wish to keep your own list of all the ports belonging to the repl server, you can't "queue" the new client for the next event loop iteration port without racing. <cpli>*the new "read-write client port" <cpli>well, if you have an actual event loop, adding the file-descriptor would likely re-trigger dispatch <cpli>is there some (define-syntax prepend-a- [...] ) which transforms (prepend-a- proc) into (a-proc)? <tonyg>cpli: you'll want to reach for syntax-case and syntax->datum and datum->syntax, in conjunction with symbol->string, string-append and string->symbol <tonyg>at least, that's how it has been traditionally. latterly systems like racket have sprouted convenience functions like format-id and format-symbol <tonyg>perhaps there's a guile equivalent of those <tonyg>making a guile equivalent in terms of the routines i mentioned above should be straightforward <rlb>cpli: depending on what you're wanting, there's also use-modules (and define-module) #:prefix.