AngouriMath

Try it live

Navigation

SettingsState


← Back to list of classes

Description

Summary

What every setting reads as, taken together, as one object, so that something holding a
result computed under the settings of a moment can tell whether those settings still hold
with one async-local read and one reference comparison.

Remarks

A state and not a change count. Counting changes looks equivalent and is not: a
scope opened and closed leaves every setting exactly as it found it while moving a
counter twice, and the library opens such scopes constantly — a single
Simplify of one unevaluated integral opened 3520 of them, all four from
numeric downcasting in Number/Operators.cs. A counter therefore reports
"everything has changed" continuously and is useless to a cache. Measured, not assumed:
the counter was built first and threw away the whole benefit.
A State is reached from the defaults by the scopes opened to reach it,
setting by setting and value by value, and is made once for each path: opening a scope of
a setting at a value from a state gives the state it gave before. So the scopes the
library opens on every call — Solve opens two — reach the same state on every
call, and a value cached under them is found again. A scope closed in order puts back
the very state it replaced, so a balanced open and close compares equal, and one closed out
of order reaches the state the scopes left open reach. Values compare by
Equals(System.Object), so a value compared by reference only is conservative:
it reaches a state of its own, and a value cached under it is not found again.
https://github.com/asc-community/AngouriMath/issues/2479

Members

























Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6091 pages online