@@ -296,10 +296,10 @@ When something goes wrong in software, focusing on which *person* to
296296blame is counterproductive, but deciding which * code* is to blame is
297297the 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> {
367367The invariant for this type is that the private arrays have the same
368368length. It's important to remember that invariants only hold at a
369369type'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
371371grow one of the arrays first, which breaks the invariant until we've
372372done the second ` append ` . That's not a problem because the arrays are
373373private—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
685685function's contract. A function with a parameter of type
686686` EmployeeDatabase ` has a precondition that the database upholds the
687687manager 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
691691dynamic language, like Javascript, or Python without type hints, you
@@ -702,7 +702,7 @@ implementation, and should be encoded in ordinary comments addressed
702702privately to the maintainer of the code. Note that you
703703can 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
11801180correctness-preserving changes are those that weaken the function's
11811181preconditions and/or strengthen its postconditions. For example, this
11821182method 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
11861186extension Collection where Element : Equatable {
0 commit comments