"Adventures in distributed programming with Scheme and PostgreSQL". A 5 minute lightning talk I gave at PGCon 2018 in Ottawa. This describes some hobbyist hacking. The code describes is very incomplete and a work in progress...
language in which the Gods wrought the universe* • Easy to rewrite code, sling code around as data • A “wormhole” system for other languages should be doable too, but that’d probably take more than one ﬂight to Canada to prototype
…” user-id) “. Today’s top story is: ” (query-single “SELECT …”))) • Blocks of code transferred to run inside the database, compiled and cached for reuse • Named variables, return values, exceptions transferred (remote (x y) (query “UPDATE foo SET x = x + $1” x) (query “UPDATE bar SET x = x + $1” y) (query “UPDATE baz SET x = x + $1” (+ x y)))
at work • Variables declared immutable can be cached in DB • Security model should probably be based on Scheme modules, perhaps controlled by a PGC_SUSET GUC? • Smarter code analysis -> implicit and/or adaptive code migration? • You could probably do this with other Lisps quite easily • You could probably do this with Python, Ruby, Java, … quite diﬃcultly (source? AST? byte-code? …)