# A simple way to implement protected

**URL:** <https://es.discourse.group/t/a-simple-way-to-implement-protected/1110>\
**Category:** 💡 Ideas\
**Created:** [November 26, 2021, 8:43pm UTC](https://es.discourse.group/t/a-simple-way-to-implement-protected/1110 "2021-11-26T20:43:14Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![aclaymore](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aclaymore/32/501_2.png) [@aclaymore](https://es.discourse.group/u/aclaymore)\
**Post date:** [November 30, 2021, 9:10am UTC](https://es.discourse.group/t/a-simple-way-to-implement-protected/1110/10 "2021-11-30T09:10:27Z")

</div>

For completeness the following is how I think protected fields would look (ignoring exact naming) if done in userland with the current [GitHub - tc39/proposal-decorators: Decorators for ES6 classes](https://github.com/tc39/proposal-decorators)

```javascript
@protectedFields
class X extends Y {
  @protect accessor #field1;
 
  @protect accessor #field2;
}

```

With the above decorators making use of the techniques already demonstrated in this thread so far.

---

_[View the full topic](https://es.discourse.group/t/a-simple-way-to-implement-protected/1110)._
