@@ -14,8 +14,9 @@ client compile-time visibility to the type's representation is both an
1414advantage and a disadvantage. Visibility to the representation makes available
1515the expressiveness of low-level syntax, such as array indexing and aggregates,
1616but in so doing allows client source code to be dependent on the
17- representation. In the vast majority of cases, the resulting economic and
18- engineering disadvantages far outweigh the expressiveness advantages.
17+ representation. In many cases, the resulting economic and
18+ engineering disadvantages of visibility on the representation will
19+ outweigh the expressiveness advantages.
1920
2021For the sake of illustration, let's create a *stack * type that can contain
2122values of type :ada: `Integer `. (We use type :ada: `Integer ` purely for the sake
@@ -111,7 +112,7 @@ The ADT may also be abstract in the sense of object-oriented programming but
111112that is an unrelated issue.
112113
113114In Ada we use *private types * to define abstract data types because private
114- types make the type's name, but not the representation, visible to clients.
115+ types make the type's name, but not its representation, visible to clients.
115116These types are composed using syntactical building blocks: a package
116117declaration, separated into two parts, containing a type declared in two parts,
117118and containing declarations for subprograms to manipulate objects of the type
@@ -203,7 +204,7 @@ The full type definition is in the package private part. Therefore, for
203204any given object of the type, the representation details |mdash | the two
204205record components in this example |mdash | can't be referenced in client code.
205206Clients must instead only use the operations defined by the package, passing
206- the client objects to the formal parameters. Only the bodies of these operations
207+ the client objects as the actual parameters. Only the bodies of these operations
207208have compile-time visibility to the representation of the :ada: `Stack `
208209parameters, so only they can implement the functionality for those parameters.
209210
@@ -216,7 +217,7 @@ mentioned, basic operations such as assignment are allowed, unless the ADT is
216217abstraction.
217218
218219You may, of course, also require other ancillary type declarations in the
219- package, either for the implementation or as additional parameters for the
220+ package, either for the implementation or as types for additional parameters for the
220221visible operations. The array type :ada: `Content ` is an example of the
221222former case. When it is strictly an implementation artifact, as in this
222223case, it should be in the private part so that it's hidden from clients.
@@ -279,7 +280,7 @@ There may be cases when what looks like an accessor function is provided, when
279280in fact the function computes the return value. Similarly, there may be
280281functions that simply return the value of a component but are part of the
281282abstraction and happen to be implementable by returning the value of a
282- component. For example, a real stacks ADT package would include a function
283+ component. For example, a real stack's ADT package would include a function
283284indicating the extent of the object |mdash | that is, the number of values
284285currently contained. In our example implementation the :ada: `Top ` component happens to
285286indicate that value, in addition to indicating the current top of the stack. The body
0 commit comments