javascript-private-state icon indicating copy to clipboard operation
javascript-private-state copied to clipboard

A proposal for private state in JavaScript (Stage 0)

Results 12 javascript-private-state issues
Sort by recently updated
recently updated
newest added

(side note, i actually agree / like that you need to use a ```this.#someMember``` as opposed to just ```this.someMember``` :-) ) What happens when a subclass declares a protected member...

What are the problems preventing the following syntax, and requiring the introduction of #? ``` class Privateer { private flag = 'GB'; constructor (flag) { this.flag = flag } getCurrentAllegiance...

I'm just wondering if there's any aspect of specifically the `private` part that isn't possible to transpile statically with Babel (beyond possible static/runtime error differences). I believe much of this...

At https://github.com/zenparsing/es-private-fields/issues/28 I write Though I cannot find it right now, on WeakRefs https://github.com/tc39/proposal-weakrefs I remember the question came up about whether it is too early for us to have...

I am of the opinion that private state should have the `@` sigil, and decorators should have the `#` sigil. Pardon me if I am bringing up a subject that...

Not to be pedantic, but the README doesn't dedicate any text to the _reason_ for adding private state to JavaScript. What's the problem you are trying to solve, in JavaScript,...

What if the private/protected property names were to be mirrored for it to work? ``` js const sharedSecret = Symbol(); class Friendly { //this class has a private property (vs...

Currently the proposal seems to simply say both cases throw a `ReferenceError` - however, there's nothing preventing an implementation from throwing a different message - ie, distinguishable error instances -...

Per your example in https://github.com/wycats/javascript-private-state#private-slots-are-lexical-and-class-private - what if `another` is a Proxy for `DataObj`? What would the proxy traps look like if the proxy is able to intercept data slot...

Having to try/catch in order to prevent a runtime `ReferenceError` doesn't seem like an elegant or performant approach - could there also be a `Reflect.hasDataSlot` or similar, that takes an...