LeaVerou / LeaVerou/proposal-class-spread

Adding methods that use fields

Open
#2 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.