85
edits
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
= The Stack = | = The Stack = | ||
I decided from the start that I wanted Lisp-style interactive development. Parenscript itself is (basically) just a function that takes code and spits out a JS string, so there's not really a development environment component to it. I found [ | I decided from the start that I wanted Lisp-style interactive development. Parenscript itself is (basically) just a function that takes code and spits out a JS string, so there's not really a development environment component to it. I found [https://github.com/johnmastro/trident-mode.el trident-mode] which is a pretty simple thing which has the HTML page long-poll Emacs for JS strings and then evals them. I wanted to do something similar to React's "fast refresh" which swaps out components while preserving state. Basically the frontend equivalent of "C-M-x'ing that sexp" and having your running program automatically update. Just as a random aside Andy Gavin also cooked up his own development environment to do this on the PS2 for the Jak series of games. | ||
I found that Preact is an alternative implementation of React in 3kb, and it has a blog post basically describing how to hook into its hot updating system. I quickly whipped up a macro which implements a JSX-like syntax, and a <code>defcomponent</code> facility for creating React components, so I can write something like this: | I found that Preact is an alternative implementation of React in 3kb, and it has a blog post basically describing how to hook into its hot updating system. I quickly whipped up a macro which implements a JSX-like syntax, and a <code>defcomponent</code> facility for creating React components, so I can write something like this: |