Skip to content

protected slots on object literals #6

Description

@ljharb

Per https://github.com/wycats/javascript-private-state#private-slots-in-object-literals - why wouldn't I be able to do:

var proto = {
  protected #data;
};
var obj = Object.create(proto);
obj.foo = function () { return this.#data; };
obj.foo();

?

In other words, why the requirement for static definition? Does that also mean that there will be no reflective mechanism for defining/adding/removing/iterating/getting/setting data slots?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions