politie / sherlock

A reactive programming library for JavaScript applications, built with TypeScript.
Apache License 2.0
39 stars 12 forks source link

Propagate immutability of derivables #71

Closed njirem closed 6 years ago

njirem commented 6 years ago

Sherlock has a special class of Derivables called Constants. Constants behave as Derivable, but are never registered as a dependency of the derivations they are used in. It might be possible to propagate this behavior (the fact that they are immutable) to Derivations that depend only on Constants.

This could improve real-life performance in some (corner) cases, because we never have to check "liveness" of cached values for these derivations when used to power a reactor.

The use of Constants is not immediately obvious in smaller, simple projects, but they are used extensively at our larger projects.