Hello

I'm happy to announce an exciting new feature of Oz 
<https://github.com/metasoarous/oz>: Live code reloading for Clojure.

This idea was inspired by a talk on data science in Clojure 
<https://www.youtube.com/watch?v=Hf4b2b3N2OU&t=1547s> by Aria Haghighi. In 
the talk Aria mused about what it might be like to bridge the divide 
between REPL, editor and notebook with a Fighweel-like hot-code reloading 
experience. This idea intrigued me and so I decided to take a stab at it.

What came from this is a function oz.core/live-reload! which takes a 
filename and initiates a watch routine. When the file changes, Oz reruns 
starting from the first changed code-form in the file (ignoring 
whitespace). This simple strategy allows for a tight feedback loop, even 
with code which periodically takes a while to fetch or process data.

If you're interested in seeing a brief demonstration of this functionality, 
please take a look at the short screencast I put together:

https://www.youtube.com/watch?v=yUTxm29fjT4

For the intrigued, this ended up being a rather interesting technical 
problem, as you can't evaluate ns forms in non-root threads (can't call set! 
on dynamic vars, such as *ns*, except in root threads apparently). However, 
I was able to get around this restriction and evaluate code in the context 
of a particular namespace from the watch threads using dynamic binding, 
like (binding [*ns* the-ns] (eval the-code)), and translating reference 
forms (:require, :import, etc.) from the ns declaration into calls to the 
equivalent clojure.core functions. Please take a look at the code 
<https://github.com/metasoarous/oz/blob/master/src/clj/oz/live.clj> if 
you're interested.

This functionality (as well as a bunch of updates to Oz's core data 
visualization utilities) is available on [metasoarous/oz "1.6.0-alpha1"] 
(expect alpha2 out shortly as well, with further updates to Vega versions). 
Please let me know what you think, and where you might see this being 
useful.


Thanks for you time

Chris


-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to