objects-classes: adding TODOs for possible future draft work

This commit is contained in:
Kyle Simpson 2022-07-24 09:58:48 -05:00
parent 28531b422a
commit ef5eb73461
No known key found for this signature in database
GPG Key ID: F5D84852C80B2DF8
2 changed files with 13 additions and 2 deletions

View File

@ -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:

View File

@ -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