Skip to content

counter.aug ​

Private state and helpers · Source and specification

Files in this project

Code ​

aug
// aug-spec: "counter.aug.md" explains this file. Read it before changes; refresh with aug spec.
interface ICounter:
    label() returns string
Counter(mutable int value) implements ICounter:
    _label():
        return _prefix()
    label():
        return self._label()
_prefix():
    return "count"
aug
// aug-spec: "counter.aug.md" explains this file. Read it before changes; refresh with aug spec.
interface ICounter {
    label() returns string
}
Counter(mutable int value) implements ICounter {
    _label() {
        return _prefix()
    }
    label() {
        return self._label()
    }
}
_prefix() {
    return "count"
}

Compiled specification ​

Interactions and sequences

ICounter · interface · source ​

ICounter.label · source ​

It returns string.

Counter · class · source ​

It implements ICounter. It takes value as an integer, kept mutable.

Counter._label · source ​

It is private to its defining scope. It returns _prefix. source

Checked interface
text
_label() returns string

Counter.label · source ​

It returns self._label. source

Checked interface
text
label() returns string

_prefix · source ​

It is private to its defining scope. It returns "count". source

Checked interface
text
_prefix() returns string

Last updated:

The world runs on language