counter.aug
Read access and mutable borrows · 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.
Counter(mutable int value) implements ICounter:
increment():
borrow self:
value = value + 1
read():
return value
interface ICounter:
increment() changes self
read() returns intCompiled specification
Counter · class · source
It implements ICounter. It takes value as an integer, kept mutable.
Counter.increment · source
It may change self. With temporary permission to change self, it increases value by 1. source
Checked interface
text
increment() returns void changes selfIt may change self.
Counter.read · source
It returns value. source
Checked interface
text
read() returns intICounter · interface · source
ICounter.increment · source
It may change self.
ICounter.read · source
It returns int.