Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

and yet another suggestion for "private but not closure" #153

@yw662

Description

@yw662

roughly just replace # with .private., which make much more sense.

since you dont like it, just try Symbol.private

example:

class foo {
    [Symbol.private] = {
        // need magic here to make it truly private
        x: 0
    }
    function bar() {
        this[Symbol.private].x += 1; // approved
    }
    ...
}
...
(new foo())[Symbol.private].x // denied

This will introduce a new well known Symbol Symbol.private, and the only thing the engine need to do is, make object[Symbol.private] private.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions