SXML became the de facto standard in the Scheme community after Oleg and others developed some powerful libraries for it, starting with Oleg's SSAX parser. SXML is also better-suited to efficient manipulation of large HTML/XML when using immutable lists.
Also, if you're looking at code examples in TFA, and thinking that, even when composing HTML using lists rather than strings, it's still susceptible to injection programming errors, then one SXML-ish improvement is:
I had an xml problem to solve at work, and used sxml to prototype solutions in CL and Guile. The CL solution was much (much) faster, but I ended up using Guile because the libraries are built in. Maybe I should try a Racket version.
Almost 20 years ago I worked at company that developed a commercial product on top of MzScheme (prior to DrScheme and Racket). There was an article about it in Russian, unfortunately now only available via web archive https://web.archive.org/web/20210506123442/http://fprog.ru/2...
I've been working on porting golang's net/http and gorilla/websocket libs to Racket for the past few months (I don't like the servelet model.) Does anyone have insight into how that model might not be optimal in a Scheme enviroment or how to better optimize it?
I'm using the Racket webserver, but each page is it own rkt file. I'm using no continuations, just storing and reading everything in the hard disk. (I'm not sure it's optimal, but I prefer that approach.)
Guile is absolutely amazing these days: it has a JIT for speed, superb POSIX support, plus you can dynamic-link in any functionality you need from a C library.
Realistically, how much data is it practical to stash inside these continuations? It seems like it could get out of hand quite quickly for non-toy examples.
If you were propagating e.g. game state, you'd still want to stick that in a db, so the continuation would just be a session id?
A continuation is a function that, when called, jumps back to a specific part of the program that was frozen (meaning current memory, the call stack, the line number). So it can't really be stored. If your game state was stored in a db, you'd still have to load it memory to perform operations on it. Those operations, if using continuations, would then stick around in memory while waiting the continuation to be resumed. If it's a multi-player game, then you'd be in real trouble as your continuation could end up with stale data.
Game state has to be propagated from the server to the client so the player knows what is happening where-as continuations as used in this article are more about avoiding this propagation (the hidden field in the example is replaced by dispatch-table tag which acts as a session id / location in the dispatch-table for finding the continuation function)
neilv|2 years ago
https://docs.racket-lang.org/sxml-intro/
SXML became the de facto standard in the Scheme community after Oleg and others developed some powerful libraries for it, starting with Oleg's SSAX parser. SXML is also better-suited to efficient manipulation of large HTML/XML when using immutable lists.
Also, if you're looking at code examples in TFA, and thinking that, even when composing HTML using lists rather than strings, it's still susceptible to injection programming errors, then one SXML-ish improvement is:
https://docs.racket-lang.org/html-template/
https://docs.racket-lang.org/rws-html-template/
gglitch|2 years ago
To your point though - sxml is fantastic.
mighmi|2 years ago
Is there a good guide to this kind of stuff as someone new to Scheme? Like a community intro, showing what the core packages are etc.?
alexott|2 years ago
nighmi|2 years ago
veqq|2 years ago
Are you stating with RFC 6455's implementation and just changing the API or trying to approximate the implementations?
gus_massa|2 years ago
_aaed|2 years ago
michaelsbradley|2 years ago
https://rash-lang.org/
Janet and Gerbil Scheme are also worth a look:
https://janet-lang.org/
https://cons.io/
bitwize|2 years ago
Guile is absolutely amazing these days: it has a JIT for speed, superb POSIX support, plus you can dynamic-link in any functionality you need from a C library.
philbo|2 years ago
If you were propagating e.g. game state, you'd still want to stick that in a db, so the continuation would just be a session id?
sheenobu|2 years ago
Game state has to be propagated from the server to the client so the player knows what is happening where-as continuations as used in this article are more about avoiding this propagation (the hidden field in the example is replaced by dispatch-table tag which acts as a session id / location in the dispatch-table for finding the continuation function)