Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update readme with syntax for private symbols #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Igmat
Copy link

@Igmat Igmat commented Jan 16, 2019

@jridgewell, I hope that I properly understood your thoughts in #1 (comment) and #1 (comment).

In order to keep it minimal, I left only private keyword and what it needs, everything else will be provided in separate repos as follow-up proposals.

Since you said, that it also should be discussed in class-fields too, should I create issue there?

they behave similarly to regular symbols, but at this time there is no
actual reification of private symbols. Private symbols can only be
access through `base.#priv` syntax.
they behave similarly to regular symbols.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't plan to introduce reification in this proposal. That'll be left to decorators. (I think only having small changes to the class-fields proposal will be easier to get through committee, and there is no reification of PrivateName included in the current class-fields)


```js
class Example {
#foo = 1;
private #foo = 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto small changes only. You might be interested in following https://github.com/bmeck/proposal-private-declarations.

## Changes

### API
Added new method to global `Symbol` built-in object for creating "private"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto no reification.

Added new method to global `Symbol` built-in object for creating "private"
symbols:
```js
const privateSymbol = Symbol.private('private symbol');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor goal is to only have private #x syntax, since Symbol.private could be monkey-patched to leak the privates.

@Igmat
Copy link
Author

Igmat commented Feb 1, 2019

So, correct me if I'm wrong. Should I move my works related to declaring symbols and shorthand syntax to https://github.com/bmeck/proposal-private-declarations repo?

Both Symbol.private and Private declarations were discussed at latest meeting and I'm curious are these approaches going to be developed further or they were rejected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants