Groups
Sign in
Groups
dev-platform@mozilla.org
Conversations
About
Send feedback
Help
Intent to Ship: Ergonomic Brand Checks
85 views
Skip to first unread message
Matthew Gaudet
unread,
May 10, 2021, 5:20:39 PM
5/10/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dev-pl...@mozilla.org
Ergonomic Brand Checks is a language feature to ease the check whether or not an object has a private value. Instead of having to write
```
hasPrivateX(o) {
try {
o.#x;
return true;
} catch {
return false;
}
}
```
you can write
```
hasPrivateX(o) { return #x in o; }
```
Which in addition to being more clear, is also safer in the presence of private getters that could throw.
Bug:
* Implement Ergonomic brand checks:
https://bugzilla.mozilla.org/show_bug.cgi?id=1648090
Proposed Standard:
*
https://tc39.es/proposal-private-fields-in-in/
Proposal Repository:
*
https://github.com/tc39/proposal-private-fields-in-in
MDN:
* Not currently documented I believe.
Platform coverage:
* all platforms
DevTools Bug:
*
https://bugzilla.mozilla.org/show_bug.cgi?id=1710516
Other Browsers:
* Shipped in Chrome 91.
Testing:
* Test262 Tests
https://github.com/tc39/test262/pull/2963
Secure contexts:
* This is a JS language feature and is therefore present in all contexts.
Reply all
Reply to author
Forward
0 new messages