Daily Shaarli

All links of one day in a single page.

August 13, 2023

Name Checker

Check a project name is available on different package managers, etc.

Controlling module dependencies
Encapsulating mutable state

How do we actually encapsulate state, and actually regain compositional reasoning, fully? The technique that actually works is confining state locally. Confining state to within an object (“encapsulation” as it’s usually meant) doesn’t get us there because the state is owned by the object and thus escapes, but fully-local to a function does successfully isolate that state.

Data as a mediator between computation and state

Instead of thinking in terms of a function that modifies multiple objects, you think in terms of a function that computes a description of how multiple objects should be affected, then a separate interpreter of that data type that animates that description into real action.

A minimal representation is the events of the DOM: they describe a change.

The author describes the advantages of such.

Note that Rust or Typescript are good candidates to represent algebraic data types.