It would be interesting if Figwheel could essentially decorate any implementation of IJavaScriptEnv
, taking on the responsibility of watching the filesystem (perhaps even delegating that to ClojureScript :watch
, and expanded :watch-fn
, and perhaps minimally calling IJavaScriptEnv -load
when Figwheel determines it is needed.
Then, for those REPLs that can participate, if IFigwheelSupport
can be extended to them, they can do further cool stuff. (Perhaps IFigwheelSupport
is actually necessary while IJavaScriptEnv
as described in the previous paragraph is insufficient, and a more fancy impl of -load
is needed?)
That way, things like the existing Node REPL could be minimally supported by Figwheel, as well as Ambly, the Browser REPL, etc.
What does IFigwheelSupport
do?
Perhaps somewhere there is a HUD interface and Figwheel can ask a REPL to display things on its HUD? An iOS or Android-specific REPL could delegate to Objective-C or Java that implement a HUD using platform-specific UI widgets.
Perhaps another thing is the "punch-through" where you add capabilities to talk to the underlying Clojure to do things.
In general though, that's all that is floating around in my mind right now: A way for Figwheel to decorate any REPL with minimal features, based on IJavaScriptEnv
, and then additional interfaces that allow them to opt into more extensive features. (Or for other people to independently extends those REPLs with those featueres, given the flexibility of Clojure).
Yeah. Simplifying it a bit, it sounds like you are describing:
For #1, I hadn't even been considering assets (CSS, images, etc.). When these resources change, you want them to end up being reflected in your running program. While this whole asset business, on the surface, seems to be outside of what the ClojureScript compiler would care about (simply because they are not code), there is
:asset-path
at least. Maybe asset management is a big part of what Figwheel is? (In other words not only code reloading but resource reloading?)For #2, in addition to richer callbacks, the load order stuff is very interesting. Reminds me of
:reload-all
. I think of:watch
as simply compiling individual files as they change, with no regard to order, and:reload-all
causing a traversal of the dependency tree. The need to know when reloading is needed and order, etc., seems to blur the line between what Figwheel is and what the compiler is doing.Philosophically , my high-level thought on all of this: Fighweel has fundamentally shown that there is a different and very compelling style of dev. (Alex Redington told me he has been Lisping for a decade and thinks the REPL is overrated and prefers the Figwheel approach. Hearing him essentially reject the REPL has stuck with me for a while.) So, if you want that style of dev (which seems to be a very common expectation now), then the question in my mind is: How much of this works its way down into the core of Clojure/ClojureScript? Is it all too new and too experimental still, and thus way to early to talk about it going into core? I bet that is at least partially true. If you accept that, how much can be put into core to at least facilitate it, so that Figwheel can take on the responsibility of implementing the missing portions?
(I've even begun to think that a "Figwheel for Clojure" makes just as much sense, and the only prior art I'm aware on that side is Stuart Sierra's Component library which, while oversimplifying, seems to help address how you make your server-side application code be reloadable.)
Also, if you accept that IDEs are in use, a question that crops up is, how does the IDE work with this style of development. I bet that this could end up being interfaces that, say Cursive or Emacs modes use to interact with Figwheel, to make the entire thing be even more integrated and more awesome. Or, maybe IDEs need do nothing, since Figwheel works at a lower level. But, if we get to the point where things like Cursive are debugging code and it changes on the fly, then maybe IDEs begin to care about the compliation / reload model, and being able to hook into it.
The above is, of course, much broader in scope than the smaller problem we are trying to bite off here, but it reflects where my mind has been floating around.
I think for now, it would be cool to at least define some minimal interfaces that allow for a Figwheel light, and if we pull that off, a few months from now, everyone may see the next obvious direction that stuff should go. (I for one can't, unless we at least try by biting off one piece at a time.)