Technomancy's place

2020/05/14 2:22:28 AM UTC

stupid nerd story that amuses me but I don't know why
on we have an interactive web-based REPL you can put code into to try out #fennel without having to install anything. it uses which is a line-by-line port of the reference C Lua VM to Javascript; somehow it works very well; we just fire-and-forget and can pretend that the whole thing is just a normal Lua runtime, other than a few tricks to work around the fact that we aren't actually running in a shell and can't use stdin/stdout but must use DOM elements for input/output instead.

someone reported a bug in the web repl. I started to try to debug it in the browser but it was such a pain in the neck to reload the whole thing every time I made a change. so instead of debugging it in the browser, I wrote a shim layer which would take the web repl, construct some fake functionality that would pretend to be a browser DOM, and run it in the shell instead:

so originally we tricked a piece of code into running in the browser, but now we are tricking our trick browser code into running where there's no browser, back in the shell where it started.

for some reason this amuses me greatly.