counters.aug diagrams
Project overview · Compiled explanation
Class interactions
Mermaid source
flowchart TD
n0["Counter"]
n1["State"]
n2["_Counter"]
n3["_Initial"]
n4["_Updated"]
n2 -->|"implements"| n0
n2 -->|"calls read; depends on _state"| n1
n2 -->|"calls"| n4
n3 -->|"implements"| n1
n4 -->|"implements"| n1
Sequences
Call arrows identify checked targets; loop and branch frames determine when they run. Open that target’s module to follow its implementation. Branches describe alternatives; loops describe repeated work. Native calls and interface dispatch stop at their declared contracts. Exit notes end that path; enclosing recovery and cleanup remain visible.
State.read
It returns int.
Interface contract; implementation selected at runtime. Explanation.
_Initial constructor
It implements State. It is private to this file.
_Initial.read
Return 0; required cleanup runs before exit. Explanation.
_Updated constructor
It implements State. It is private to this file.
It takes count as an integer, kept read-only.
Receive fields: count. Explanation.
_Updated.read
Return count; required cleanup runs before exit. Explanation.
Counter.increment
It may change self.
Interface contract; implementation selected at runtime. Explanation.
Counter.value
It returns int.
Interface contract; implementation selected at runtime. Explanation.
_Counter constructor
It implements Counter. It is private to this file.
The _state dependency is injected as State and stored mutably and privately.
Receive fields: injected _state. Explanation.
_Counter.increment
It may change self.
Mermaid source
sequenceDiagram
participant p0 as _Counter.increment
participant p1 as _state: State
participant p2 as _Updated
p0->>p1: read() · interface dispatch
p1-->>p0: read result: int
p0->>p2: _Updated(count=read result + 1)
p2-->>p0: _state: _Updated
_Counter.value
Mermaid source
sequenceDiagram
participant p0 as _Counter.value
participant p1 as _state: State
p0->>p1: read() · interface dispatch
p1-->>p0: read result: int
Note over p0: Return _state.read(); required cleanup runs before exit
Called contracts
- Counter — counters.aug
- State — counters.aug
- State.read — counters.aug
- _Updated — counters.aug