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

Add public #x #5

Open
Igmat opened this issue Apr 6, 2019 · 0 comments
Open

Add public #x #5

Igmat opened this issue Apr 6, 2019 · 0 comments

Comments

@Igmat
Copy link

Igmat commented Apr 6, 2019

We don't know what is private #x yet (I hope #4 will be answered soon), but it seems to be some kind of symbol.

It makes sense to have public #x notation in this case, doesn't it?
I propose it to be kinda like shorthand for const x = Symbol(). But in this case, it have much more sense to have class-fields affected like in #1.

Examples:

public #x;
existingObj.#y = 1; // throws because #y isn't declared yet
const obj = {
    #x: 1,
    public #y: 1,
};
const otherObj = {
    public #x: 1, // shadows `#x` from outer lexical scope
    #y: 1, //  throws because #y isn't declared yet in this scope
};
public #x;
existingObj.#y = 1; // throws because #y isn't declared yet
class SomeClass {
    #x = 1;
    public #y = 1;
};
class SomeOtherClass = {
    public #x = 1; // shadowed `#x` not shared with `SomeClass`
    public #y = 1; // another `#y` not shared with `SomeClass`
};
@Igmat Igmat mentioned this issue Apr 6, 2019
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

No branches or pull requests

1 participant