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

2015-08-27 Thread Ron Waldon
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:

http://usejsdoc.org/about-namepaths.html

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.
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


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

2015-08-27 Thread Kevin Smith

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


This would be written return super.method();


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


var args = Array.from(arguments);

(or rest params)

Have all use cases for this idea already been squashed by ES2015?


Yes, for the common use cases.

Kevin
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss