domain/numbers.aug diagrams
Project overview · Compiled explanation
Class interactions
Mermaid source
flowchart TD
n0["Positive"]
n1["double"]
n1 -->|"intercepted by"| n0
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.
RangeError constructor
Raised when an input is outside the operation's domain. It implements Error.
It takes value as an integer, kept read-only.
Receive fields: value. Explanation.
Positive.around
It takes amount as an integer.
Failures can raise RangeError.
Mermaid source
sequenceDiagram
participant p0 as Positive.around
participant p1 as next
alt amount is negative
p0->>p0: RangeError(value=amount) · construct value
p0-->>p0: RangeError result: RangeError
Note over p0: Raise checked failure RangeError(value=amount); required<br/>cleanup runs before exit
end
p0->>p1: next() · conditional interceptor delegation
p1-->>p0: next result: int
Note over p0: Return next(); required cleanup runs before exit
Note over p0: May leave with checked errors: RangeError
double
Double a nonnegative amount.
It takes amount as an integer.
It returns int — Twice the amount, with defined integer wrapping. Failures can raise RangeError (A validation layer rejected a negative input).
Layers run in the declared order. Call Positive.around.
Applied layers: Positive; may stop or change delegation; see specification. Return amount * 2; required cleanup runs before exit. May leave with checked errors: RangeError. Explanation.
Called contracts
- Positive — domain/numbers.aug
- RangeError — domain/numbers.aug
- double — domain/numbers.aug