Skip to content

Commit ff45c64

Browse files
authored
fix: spelling mistakes (#33)
1 parent 45d78f5 commit ff45c64

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,10 @@ When something goes wrong in software, focusing on which *person* to
296296
blame is counterproductive, but deciding which *code* is to blame is
297297
the first step. Contracts tell us which code needs fixing:
298298

299-
- If preconditions aren't satisifed, that's a bug in the caller. The
299+
- If preconditions aren't satisfied, that's a bug in the caller. The
300300
function is not required to make any promises[^no-promises] in that case.
301301

302-
- If preconditions are statisfied but postconditions are not
302+
- If preconditions are satisfied but postconditions are not
303303
fulfilled, that's a bug in the callee, or in something it calls.
304304

305305
[^no-promises]: In fact, a function *shouldn't* make any promises in
@@ -367,7 +367,7 @@ struct PairArray<X, Y> {
367367
The invariant for this type is that the private arrays have the same
368368
length. It's important to remember that invariants only hold at a
369369
type's public interface boundary and are routinely violated,
370-
temporarily, durign a mutation. For example, in `append`, we have to
370+
temporarily, during a mutation. For example, in `append`, we have to
371371
grow one of the arrays first, which breaks the invariant until we've
372372
done the second `append`. That's not a problem because the arrays are
373373
private—that “bad” state is *encapsulated* by the type, and
@@ -685,7 +685,7 @@ Everything you see in a function signature is implicitly part of the
685685
function's contract. A function with a parameter of type
686686
`EmployeeDatabase` has a precondition that the database upholds the
687687
manager invariant, but it doesn't need to be stated explicitly; it's
688-
enforced automatically by the compiler and the implementor of
688+
enforced automatically by the compiler and the implementer of
689689
`EmployeeDatabase`. So static typing gives you a leg up on the
690690
“document everything” project. If you were programming in a totally
691691
dynamic language, like Javascript, or Python without type hints, you
@@ -702,7 +702,7 @@ implementation, and should be encoded in ordinary comments addressed
702702
privately to the maintainer of the code. Note that you
703703
can have both: `PairArray` *also* has a public invariant that its
704704
`count` is non-negative. We'll get to why this particular invariant
705-
is not explicitlty documented in a moment…
705+
is not explicitly documented in a moment…
706706

707707
### Making It Tractable
708708

@@ -1180,7 +1180,7 @@ But suppose you want to change a function's contract? The
11801180
correctness-preserving changes are those that weaken the function's
11811181
preconditions and/or strengthen its postconditions. For example, this
11821182
method returns the number of steps from the start of a collection to
1183-
an occurence of some value.
1183+
an occurrence of some value.
11841184

11851185
```swift
11861186
extension Collection where Element: Equatable {

0 commit comments

Comments
 (0)