Skip to content

Commit 8d61f0f

Browse files
committed
Light pass over chapter 6
1 parent b04db57 commit 8d61f0f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

06_object.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Even better, it may be possible to use object classes in multiple different prog
3737
{{id interface}}
3838
{{index [interface, object]}}
3939

40-
Each abstract data type has an _interface_, which is the collection of operations that external code can perform on it. Even basic things like numbers can be thought of as an abstract data type whose interface allows us to add them, multiply them, compare them, and so on. In fact, the fixation on _objects_ as the main unit of organization in classical object-oriented programming is somewhat unfortunate, since often useful pieces of functionality involve a group of different object classes working closely together.
40+
Each abstract data type has an _interface_, which is the collection of operations that external code can perform on it. Even basic things like numbers can be thought of as an abstract data type whose interface allows us to add them, multiply them, compare them, and so on. In fact, the fixation on single _objects_ as the main unit of organization in classical object-oriented programming is somewhat unfortunate, since often useful pieces of functionality involve a group of different object classes working closely together.
4141

4242
{{id obj_methods}}
4343

@@ -167,7 +167,7 @@ blackRabbit.speak("I am fear and darkness");
167167

168168
{{index "shared property"}}
169169

170-
The "proto" rabbit acts as a container for the properties that are shared by all rabbits. An individual rabbit object, like the killer rabbit, contains properties that apply only to itself—in this case its type—and derives shared properties from its prototype.
170+
The "proto" rabbit acts as a container for the properties that are shared by all rabbits. An individual rabbit object, like the black rabbit, contains properties that apply only to itself—in this case its type—and derives shared properties from its prototype.
171171

172172
{{id classes}}
173173

@@ -232,7 +232,7 @@ ArchaicRabbit.prototype.speak = function(line) {
232232
let oldSchoolRabbit = new ArchaicRabbit("old school");
233233
```
234234

235-
All functions start with a `prototype` property holding an empty object, for this reason.
235+
For this reason, all non-arrow functions start with a `prototype` property holding an empty object.
236236

237237
{{index capitalization}}
238238

@@ -295,7 +295,7 @@ class SecretiveObject {
295295
}
296296
```
297297

298-
If you try to call `#getSecret` from outside the class, you get an error message. Its existence is entirely hidden inside the class declaration.
298+
If you try to call `#getSecret` from outside the class, you get an error. Its existence is entirely hidden inside the class declaration.
299299

300300
To use private instance properties, you must declare them. Regular properties can be created by just assigning to them, but private properties _must_ be declared in the class declaration to be available at all.
301301

@@ -481,7 +481,7 @@ I mentioned in [Chapter ?](data#for_of_loop) that a `for`/`of` loop can loop ove
481481

482482
It is possible for multiple interfaces to use the same property name for different things. For example, on array-like objects, `length` refers to the amount of elements in the collection. But an object interface describing a hiking route could use `length` to provide the length of the route in meters. It would not be possible for an object to conform to both these interfaces.
483483

484-
An object trying to be a route and array-like (maybe to enumerate its waypoints) is somewhat far-fetched, and this kind of problem isn't that common in practice. But for things like the iteration protocol, the language designers needed a type of property that _really_ doesn't conflict with any others. So in 2015, _((symbol))_s were added to the language.
484+
An object trying to be a route and array-like (maybe to enumerate its waypoints) is somewhat far-fetched, and this kind of problem isn't that common in practice. But for things like the iteration protocol, the language designers needed a type of property that _really_ doesn't conflict with any others. So in 2015, _((symbol))s_ were added to the language.
485485

486486
{{index "Symbol function", [property, naming]}}
487487

@@ -651,7 +651,7 @@ console.log([..."PCI"]);
651651

652652
{{index [interface, object], [property, definition], "Map class"}}
653653

654-
Interfaces often plain properties, not just methods. For example, `Map` objects have a `size` property that tells you how many keys are stored in them.
654+
Interfaces often contain plain properties, not just methods. For example, `Map` objects have a `size` property that tells you how many keys are stored in them.
655655

656656
It is not necessary for such an object to compute and store such a property directly in the instance. Even properties that are accessed directly may hide a method call. Such methods are called _((getter))s_, and they are defined by writing `get` in front of the method name in an object expression or class declaration.
657657

0 commit comments

Comments
 (0)