Hyperfiddle is in essence metadata driven UI, where the UI reconfigures itself in response to live changing metadata and this reactive reconfiguration needs to happen in milliseconds. The fundamental problem with Reagent (as described in this thread) is that you don’t get to program with closures. You’ll note in the code link i posted that there is not a single closure in view code, there are only six occurrences of (fn [...])
in 1000+ LOC and those six closures are e.g. contained within reduce (if the closure escapes and ends up passing through hiccup it would be a prop equality bug). Hundreds maybe thousands of devs are using Reagent without understanding this, they get away with it due to a very specific symmetry: in the value/onChange pattern the closure travels alongside a corresponding value, and if the onChange closure was rebuilt then the value also was likely changed, so the unstable closure ref is actually not harming anything because the component was about to re-render anyway due to the value changing. Also as Val hints at, views are hard to generalize and therefore most people just write boilerplate with very little usage of closures other than change handlers so they don’t hit this problem in practice. TLDR reagent is easy but not simple.
4 Likes