Why was this a requirement? I have a class, we’ll call a, which I want to
extend from b, but I don’t want to call the constructor. I just want to inherit
a few functions from it.
___
es-discuss mailing list
es-discuss@mozilla.org
Neither the base (parent) nor derived (child) class requires a constructor, nor
does the child class require a `super()` call. If you omit either constructor,
an assumed one is present. However, if you *do* declare a constructor in a
derived class, you'll need to call `super()` in it.
So, to
The reason why you need to call the super-constructor from a derived class
constructor is due to where ES6 allocates instances – they are allocated by/in
the base class (this is necessary so that constructors can be subclassed that
have exotic instances, e.g. `Array`):
```js
// Base class
On 9 April 2015 at 16:11, Jussi Kalliokoski jussi.kallioko...@gmail.com wrote:
On Thu, Apr 9, 2015 at 4:04 PM, liorean lior...@gmail.com wrote:
Do we really need it?
Your «foo(1, ?, 2);» is equivalent to «a=foo(1,a,2)».
Your «foo(?, 1, ???);» is equivalent to «(a,...b)=foo(a,1,...b)».
Your
On 4/10/15, Axel Rauschmayer a...@rauschma.de wrote:
The reason why you need to call the super-constructor from a derived class
constructor is due to where ES6 allocates instances - they are allocated
by/in the base class (this is necessary so that constructors can be
subclassed that have
Babel is a terrible reference implementation for subclassing since it relies on
the engine. See the docs http://babeljs.io/docs/usage/caveats/#classes and
https://github.com/babel/babel/issues/1172 for more info. This exact question
(super in derived class constructors) was also indirectly
No engine has implemented subclassing of `Array`, yet:
http://kangax.github.io/compat-table/es6/#Array_is_subclassable
http://kangax.github.io/compat-table/es6/#Array_is_subclassable
And, as Sebastian mentioned, you can’t transpile it, because it depends on the
cooperation of `Array`: it
No engine has implemented subclassing of `Array`, yet:
http://kangax.github.io/compat-table/es6/#Array_is_subclassable
http://kangax.github.io/compat-table/es6/#Array_is_subclassable
https://github.com/v8/v8-git-mirror/blob/master/test/mjsunit/harmony/classes-subclass-arrays.js
On Apr 10, 2015, at 8:06 PM, Axel Rauschmayer a...@rauschma.de wrote:
...
If you do not call `super()`, you only get into trouble if you access `this`
in some manner. Two examples:
...
Therefore, there are two ways to avoid typing super-constructor calls.
First, you can avoid
On Apr 10, 2015, at 10:29 PM, Axel Rauschmayer a...@rauschma.de wrote:
No engine has implemented subclassing of `Array`, yet:
http://kangax.github.io/compat-table/es6/#Array_is_subclassable
http://kangax.github.io/compat-table/es6/#Array_is_subclassable
And, as Sebastian mentioned, you
10 matches
Mail list logo