Skip to content

Instantly share code, notes, and snippets.

@mfikes
Created June 6, 2015 16:35
Show Gist options
  • Save mfikes/2d30a535a82830192775 to your computer and use it in GitHub Desktop.
Save mfikes/2d30a535a82830192775 to your computer and use it in GitHub Desktop.
Figwheel light ideas

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).

@mfikes
Copy link
Author

mfikes commented Jun 6, 2015

An additional thought: Would ICompileWatcher matter to Clojure? Perhaps it does for ClojureScript because it must be transpiled? But in Clojure does it only matter when AOT?

@bhauman
Copy link

bhauman commented Jun 6, 2015

This sounds good.

This doesn't deliver the info to the REPL-Env. A smarter ReplEnv may want it. But that may just be a complected REPL.

What do you think?

@bhauman
Copy link

bhauman commented Jun 14, 2015

Time is a good thing. ICompileWatcher seems like it would work really well.

I would add one more method to ICompileWatcher:
before-compile
after-compile
on-warning
on-error

before-compile would allow one to mark certain files for recompile before the compile kicks off
before-compile should be passed the files that changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment