This repository was archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Switch to lexically declarations in classes #10
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jan 12, 2018
robpalme
reviewed
Jan 12, 2018
README.md
Outdated
Counter.count; // 1, own property | ||
SubCounter.count; // 0, own property | ||
|
||
// ++ is just dealing iwth own properties the whole time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: iwth -> with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this correction. There are lots of typos here; probably better for others not to spend time looking for them until I do another pass over things.
Based on feedback in #4
This reverts commit f3f1341.
This reverts commit 11a92e5.
This patch specifies lexically scoped declarations in class bodies, with a token preceding them. Because we haven't figured out which token to use (#9), <placeholder> is used instead. Some main design points: - let, const, class and function (including async fns, generators) are supported, and var declarations are not supported. - Function declarations are hoisted to the top of the block, before evaluating the extends clause. - let, const and class declarations are evaluated interspersed with static public field initializers. - The class is visible with a binding initialized when the lexical declarations are evaluated. - Unlike static public field initializers which are in a scope analogous to a method (with super property access, and this being the class), the scope of lexical declarations inherits directly from the outer scope, similarly to computed proerty names and the extends clause, which implies: - this, super, new.target are inherited from the lexical context, and are not related to the current class definition. - arguments is not poisoned and is inherited from an outer definition - yield, await can be used if possible in the enclosing function.
This hasn't had much time for review yet, but merging early so that more people can get a look at the proposal. Please keep the reviews coming, either in comments on this thread or bugs/PRs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on feedback in #4