Skip to content

Commit 0d00da7

Browse files
author
Dave Abrahams
committed
Merge branch 'main' of github.com:stlab/better-code into types
2 parents 12480f4 + a185dc1 commit 0d00da7

3 files changed

Lines changed: 950 additions & 3 deletions

File tree

better-code/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
- [Introduction](./chapter-1-introduction.md)
44
- [Contracts](./chapter-2-contracts.md)
5+
- [Errors](./chapter-3-errors.md)
56
- [Types](./chapter-4-types.md)

better-code/src/chapter-2-contracts.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ It's an invariant of your program that a manager ID can't just be
640640
random; it has to identify an employee that's in the database—that's
641641
part of what it means for the program to be in a good state, and all
642642
through the program you have code to ensure that invariant is upheld.
643+
643644
#### Encapsulating invariants
644645

645646
It would be a good idea to identify and document that whole-program
@@ -815,9 +816,9 @@ the array has an element. OK, so what about postconditions?
815816

816817
The postconditions are the effects of the method plus any returned
817818
result. If the preconditions are met, but the postconditions are not,
818-
and the function does not report an error, we'd say the method has a
819-
bug. The bug could be in the documentation of course, *which is a
820-
part of the method*.
819+
and the function does not report a runtime error, we'd say the method
820+
has a bug. The bug could be in the documentation of course, *which is
821+
a part of the method*.
821822

822823
```swift
823824
/// Removes and returns the last element.

0 commit comments

Comments
 (0)