LeaVerou / LeaVerou/proposal-class-spread
Adding methods that use fields
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
The only (modulo the contstructor return hack) way that fields from a class X can be installed onto an instance is for a class to extend expressionThatResultsInX. It seems like it would violate the entire encapsulation purpose of private fields to allow them to be applied onto anything else - so, following that logic, a class with fields simply wouldn't be practically spreadable onto another class, unless the developer explicitly overrode the definitions of any methods that used the fields (and if that includes the constructor, that means that it would have to avoid calling super).
How do you imagine this working?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test entry point is named. Start by examining the private-field and extend cases described in the issue, then review the proposal’s current design and discussion for an agreed direction. Done means the semantics are resolved and documented in the proposal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100