mirror of
https://github.com/getify/You-Dont-Know-JS.git
synced 2025-03-12 05:00:26 +08:00
objects-classes: adding TODOs for possible future draft work
This commit is contained in:
parent
28531b422a
commit
ef5eb73461
@ -15,7 +15,7 @@ At the time of ES6's `class` being introduced, this new dedicated syntax was alm
|
||||
|
||||
Even though `class` now bears almost no resemblance to older "prototypal class" code style, the JS engine is still *just* wiring up objects to each other through the existing `[[Prototype]]` mechanism. In other words, `class` is not its own separate pillar of the language (as `[[Prototype]]` is), but more like the fancy, decorative *Capital* that tops the pillar/column.
|
||||
|
||||
That said, since `class` style code has now replaced virtually all previous "prototypal class" coding, the main text here focuses only on `class` and its various particulars. For historical purposes, we'll briefly cover the old "prototypal class" style in Appendix A.
|
||||
That said, since `class` style code has now replaced virtually all previous "prototypal class" coding, the main text here focuses only on `class` and its various particulars. For historical purposes, we'll briefly cover the old "prototypal class" style in an appendix.
|
||||
|
||||
## When Should I Class-Orient My Code?
|
||||
|
||||
@ -410,6 +410,10 @@ It also adds a new `z` field/member method, as well as a `printDoubleX()` method
|
||||
|
||||
When `anotherPoint.printDoubleX()` is invoked, the inherited `this.getX()` is thus invoked, and that method makes reference to `this.x`. Since `this` is pointing at the class instance (aka, `anotherPoint`), the value it finds is now `21` (instead of `3` from the `point` object's `x` member).
|
||||
|
||||
### Extending Expressions
|
||||
|
||||
// TODO: cover `class Foo extends ..` where `..` is an expression, not a class-name
|
||||
|
||||
### Overriding Methods
|
||||
|
||||
In addition to overriding a field/member in a subclass, you can also override (redefine) a method:
|
||||
|
@ -46,4 +46,11 @@
|
||||
* Delegation Illustrated
|
||||
* Composing Peer Objects
|
||||
* Why *This*?
|
||||
* Appendix A: TODO
|
||||
* TODO:
|
||||
* object wrappers (String, Boolean, etc)
|
||||
* object coercions (valueof, tostring, boxing)
|
||||
* well-known symbols extension points on objects
|
||||
* proxies
|
||||
* old "prototypal class" style
|
||||
* "inheritance" objections
|
||||
* protected visibility
|
||||
|
Loading…
x
Reference in New Issue
Block a user