Javascript is getting a new keyword I proposed (accessor)
Introduction
This is a short story about how I proposed a name for a new Javascript keyword, and it got accepted.
The dark age of javascript
Most people I know treat programming languages they know as a given. The same way we accept the existence of our universe, we don't know who made it, or how it was made, we try do understand how it works, and just accept it. Javascript for a long time has been a language that felt static (feature-wise) for almost a decade, during the dark age of IE6 monopoly. We kinda got used to working around the limitations of the language.
The excitement era
It's the end of the browser wars, and now we see a rapid development of not only Javascript as a language but also the entire web platform (HTML5, CSS3, new DOM APIs), some people even think it was evolving too fast. But for me, I was super excited about everything that was coming. Stuff that was painful to use or felt ancient was finally going to be fixed, and new features were going to enable what was impossible.
The unreachable
I always felt that I had a good grasp of Javascript, DOM, and all the quirks that make people hate web development. But at the time suggesting an idea wasn’t even something I considered, it felt like trying to question the president about why something is the way it is or trying to talk to the pope, It felt impossible. I knew there was a group of people responsible for making decisions. But they were untouchable godly figures, are they even normal humans? I questioned. I felt small, unimportant, no one knew I existed. Why would anyone want to hear what I have to say, I'm not a Google or Microsoft engineer.
Open process
This is how I felt for a long time, but I was still excited about the evolution of the web. I wanted to know what was coming next. But what I could find in the news outlet and media wasn't enough for me. Until I discovered the wonders of the open process that happens on the TC39 and WHATWG GitHub org. You can see on your own, what's being proposed and discussed in real-time! Except the people making the decisions are not faceless, untouchable gods like I thought. They are for the most part developers like me and you. And the best of all, comments are open to the public. All you need is a GitHub account and be willing to put your thoughts in a structured manner. As far as my understanding goes, it used to be a bit harder to get involved when things happened through mailing lists, but I never understood those.
The feature
Javascript is getting Decorators. If you don't know what that is I'm going to quote the original proposal:
Decorators have three primary capabilities:
- They can replace the value that is being decorated with a matching value that has the same semantics. (e.g. a decorator can replace a method with another method, a field with another field, a class with another class, and so on).
- They can provide access to the value that is being decorated via accessor functions which they can then choose to share.
- They can initialize the value that is being decorated, running additional code after the value has been fully defined. In cases where the value is a member of class, then initialization occurs once per instance.
Essentially, decorators can be used to metaprogram and add functionality to a value, without fundamentally changing its external behavior.
You can continue reading it here:Â https://github.com/tc39/proposal-decorators
The naming problem
As part of the decorators proposal, one feature regarding decorating getters and setters was being called a name I really felt wasn't good (props), so I quickly wanted to propose a new name. Fortunately, I wasn't alone, and a thread had been started already, but no good names were suggested so far in my opinion. And as they say: naming is one of the hardest things in computer science.
So far the initial proposal was calling for “props”, which is a technically correct name, but we use it so much in different contexts that for me it was clear that it was going to cause confusion, not to mention it was certainly going to be hard to google that keyword.
The suggestion
I did my research, a lot of Wikipedia, looking for synonyms, it needed to be something that conveyed what it did but have some connections with other languages since decorators is not a new idea. Then I came up with this comment:
At first, it didn't seem to go anywhere, TC39 was still favorable on the prop keyword.
And then all of the sudden this happened:
And finally this!
I encourage you to read the thread by yourself, I won't go into much detail in this post.
Conclusion
First, I know you might argue that anyone could have suggested the same name, some people even came independently to the same name, and TC39 might even have had the same idea on their own when in a private meeting, I'm not even the first person to call that an accessor, other languages have that, I was just the first person to mention that name on that thread. But that's not the point, the point is: I pointed out why I think it was a better choice, some people disagreed, some people agreed, and that's the beauty of the entire process, even tho I don't have the final say, I'm making myself heard. Even a simple comment is still a valid contribution to the standards. As much as I admire the work TC39 puts towards ECMAScript, they are still people that make mistakes. So if you use the language and care about it, your opinion might change the future.
What was the first open-source project you contributed to?