DEV Community

Discussion on: You Can Create Private Properties In JS (accessor pattern)

Collapse
 
benaryorg profile image
#benaryorg

Wouldn't a convention/readme saying "don't touch references starting with an underscore" suffice for that?
Building wrappers and doing language-magic seems a bit overkill.

Thread Thread
 
guitarino profile image
Kirill Shestakov

If it suffices for you to just mention it in Readme, good. It's probably not enough for me.

Also, the method I described doesn't require you to do wrappers. It requires you to create a closure, but you should probably have it anyway (module pattern).