JSDoc3-style operator to access property of prototype(s)

Ron Waldon jokeyrhyme at gmail.com
Fri Aug 28 01:36:10 UTC 2015

I've been using JSDoc 3 for documentation of JavaScript code for years now,
and it recently occurred to me that maybe the "instanceMember" namepath is
a candidate for inclusion in ECMAScript proper:


The # operator would effectively be syntax sugar for .prototype.

Some examples:

MyConstructor#method === MyConstructor.prototype.method; // true

class Child extends Parent {
  method () {
    // TODO: do something more than Parent would
    return Parent#method.call(this);
    // equivalent to Parent.prototype.method.call(this);

var args = Array#slice.call(arguments, 0);

Now, some of these examples may be anti-patterns in an ES2015 world, but I
wonder whether .prototype.foo is accessed frequently enough in enough code
(even post-ES2015) that there's some merit here.

For me, it would make argument wrangling and ES5 class code more
convenient, and it would also bring extra parity between my JSDoc content
and the actual code it documents.

Have all use cases for this idea already been squashed by ES2015? I realise
there is a high threshold for syntax changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150828/17888b95/attachment-0001.html>

More information about the es-discuss mailing list