Notes on 'Metaphysics and JavaScript'


0 reactions 2019-08-28

Slides here

Rich Harris gave an excellent unrecorded talk tonight at useReactNYC on Metaphysics and JavaScript. Much of it was above my paygrade, and I don’t have access to his slides, but I love every opportunity to dissect Rich Harris insights so I figured I would jot down some notes from (my very holey) memory, in my words.

Because this talk had a lot of flair, and I am trying to learn how to package my talks better, I break it up into content vs style points, while acknowledging that it isn’t Rich’s intention to have these evaluated separately but its my blog so I call the shots.

Crux of the Argument

  • “UI as a function of State” is a leaky abstraction
    • Immediate mode rendering is nice for game development (he showed a beautiful 500 line 3d animated scene render example where this does work)
    • BUT the DOM fundamentally is stateful (especially where it comes to transitions as time is seldom explicitly accounted for)
    • React tries to provide an abstraction with a runtime patching DOM diffs. This is good. to a point.
    • Why not stop fighting the stateful DOM and embrace it with templates, reactivity, and a compiled approach?
      • leads to the objectively better things he’s talked about in prior talks like speed, size, less code
    • But this core argument is why Svelte is subjectively better
      • also it has scoped css, animations, 2 way binding, a11y linting built in.
  • Aside: React and functional programming/purity (cf. wycats on sebmarkbage comment)
    • “People are horny for functions”. FP is too seductive.
    • React used to have lifecycles in class components. Made it feel OO.
    • React/Eucalyptus Avatar pulled off “syntatical jiu-jitsu” with Hooks, made everything a result of render, even side effects (c.f. ryanflorence comment on synchronizing with state)
    • “Functions all the way” is very nice, but still has impedance mismatch (see above). Also stale closure problems.

I think I noted down all the substantive points in the talk here. A few of us reported losing the thread of the argument particularly in the 180 reversal from admiring immediate mode for gamedev to arguing that DOM’s should be retained mode, but this was clarified in post talk drinks.

Style Points

This talk was heavily wrapped up in a delightful package of metaphysical discussion, involving:

  • The Ship of Theseus - I don’t remember what the analogy was here
  • This Heraclitus quote, where I think the message was time matters, UI = f(State) is an illusion


  • Plato’s Allegory of the Cave which I found the most apt, which was the attraction of developers around the idea of components, but looking at React and thinking that this is the ultimate expression of that ideal, when in reality the core idea can be done without looking through the blurry shadows of FP


I found this approach extremely fun for a meetup talk, especially as someone familiar with all the allegories, but for someone new to any of these it might be too much cognitive load to juggle both the meta and the message. Eh.

There were also a couple other stylistic notes I loved, specifically in the introduction.

Rich started by recapping his 3 prior talks at JSConfEU, YGLF, and JSCamp Barcelona (not yet recorded, but meeting Jenn Creighton was the proximate cause of coming to speak at useReactNYC). I dont remember what exactly was said but each talk was neatly wrapped up and contrasted against each other in one sentence each and I thought that this was a very nice shorthand for longtime observers (“Previously on…”) as well as homework for newcomers.

Finally, one of his last contrast points, that “Svelte is objectively better than React” also served as the context setter for this talk, that “Svelte is subjectively better than React”. A bit of a troll framing of course, but very effective in indicating that we’re going to talk about the Why, not the What.

Get updates on new posts and projects

3000+ subscribers including my Mom – see past issues

Leave a reaction if you liked this post! 🧡