Racket applications over Gemini

After a colleague of mine was demonstrating his Scheme-based Spotify client, I had a crazy idea:

What if there were a Racket based application type for Gemini, allowing the safe execution of sandboxed Racket GUI code?

Having found Fafi, it turns out it's really easy to hack in demo-quality support for this idea; implemented as a racket-renderer with the following guts:

(define/public (set-content content)
  (parameterize ([sandbox-gui-available #t])
    (let ((evaluator (make-evaluator 'racket/gui)))
      ;; HACK - workaround for a bug:
      ;; https://stackoverflow.com/a/72423109/181452
      (evaluator "(current-eventspace (make-eventspace))")
      (evaluator content))))

In this particular case I'm serving the Racket source from Dʒɛmɪni (https://sr.ht/~rwv/dezhemini/), having hacked it to serve Racket files with an additional MIME type:

 (#".rkt"      . "application/racket")

So now I can serve up a simple hello world Racket GUI app and have it pop up a new frame from Fafi. But ... I have questions :)

Is this a direction you'd like Fafi to head in? While in keeping with the letter of the Gemini protocol law, I'm wondering about potential fragmentation here (these apps wouldn't work on, say, Plan 9). Would a more broadly available language be a better fit? OTOH, Racket has great (if a little buggy ;) ) sandbox support baked in ...

Anyway, thought I'd put this idea out there for your consideration. If you'd like to proceed at least with experimenting in this direction, I'm happy to submit a patch or several. Some thoughts on requirements ...

  1. Sandboxing. What, exactly, should a Gemini based Racket app be able to access? I'm thinking it might even make sense to limit it, CORS-style, to Gemini connections to the originating host.

  2. Libraries and app composition. How on earth would this work from a single Racket file, in practice, for non-trivial applications?

  3. Local storage. I'm guessing applications would need to have some way of persisting state, even if sandboxed very tightly.

Anyways, thanks for making Fafi, happy to chat further about the above if it's of interest :)

Assigned to
2 years ago
1 year, 4 months ago
No labels applied.

~soapdog 2 years ago


I think this is great! You've done fantastic work there. I don't feel it is quite in the spirit of Gemini though, the community wants Gemini to be a document sharing network more than an application sharing platform, but that doesn't preclude you adding that feature at all. It will just be a exclusive feature of that client.

I haven't been focusing on Fafi lately, I'm working on other projects that are not Racket-based. What I would recommend is for you to fork the project and take it forward with your own vision. I don't want my lack of attention to Fafi to block you from doing cool stuff. I'm only touching this project once every couple months, that is not active enough to warrant contributors sending patches. It is not respectful with the people contributing to have their code linger for weeks without any comment.

So, what I want to say is that I'm quite impressed by what you've accomplished and that I think the best way forward for that kind of vision is to be independent from Fafi which is currently so slow moving that it might be frozen.

~soapdog REPORTED NOT_OUR_BUG 1 year, 4 months ago

Register here or Log in to comment, or comment via email.