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).
Really agreeing that this should have minimum impact for the compiler until this crazy way of doing things has more time in the world.
I have been thinking that the idea of a single ICompileWatcher (on-compile, on-warning, on-error) fits into to the idea of a watching compiler. It would be great if this could present warning and error information, its a bonus to have any sort of file change data.
The rest of the changes can be detected from the environment given this information. Maybe grabbing this info from the env can eventually reside in the notion of the CLJS build API.
It's kind of a bummer that the client of this ICompileWatcher api would have to asynchronously collect the warnings to associate them with a compile.
It seems with these ingredients we could decorate a REPL-Env to autoloading in a straightforward way.
As far as the bigger picture is concerned, I am thinking that along with IDEs, build scripts that can compose all this crazy stuff folks want to do with build tools are probably going to be a winning strategy. It would be nice if the API didn't "get in the way" of this happening, but rather supported and encouraged it.