Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify parent method call #8

Open
albanx opened this issue Jan 22, 2015 · 2 comments
Open

Simplify parent method call #8

albanx opened this issue Jan 22, 2015 · 2 comments

Comments

@albanx
Copy link

albanx commented Jan 22, 2015

Hi
Actually this is the simple and best performance class definition in javascript. I have analised it and compared with other javascript libs.
Now in my opitionion the best would be to simplyfy parent method access from child. For example: if now it is Child.Super.prototype.setAddress.call(this);
make something like this:
this.parent.setAddress.call(this, 'France', city, street);

I will try to do that.

@jiem
Copy link
Owner

jiem commented Jan 22, 2015

Thanks Alban!

the _"this.parent.setAddress.call(_this, 'France', city, street);" syntax
doesn't work if there are more than 2 inheritance levels (infinite loop).
The access to the parent constructor must be static (no "this").

See more in the section "Extend a class" of http://jiem.github.io/my-class/

Cheers

On Thu Jan 22 2015 at 8:06:33 AM Alban [email protected] wrote:

Hi
Actually this is the simple and best performance class definition in
javascript. I have analised it and compared with other javascript libs.
Now in my opitionion the best would be to simplyfy parent method access
from child. For example: if now it is
Child.Super.prototype.setAddress.call(this);
make something like this:
this.parent.setAddress.call(this, 'France', city, street);

I will try to do that.

Reply to this email directly or view it on GitHub
#8.

@albanx
Copy link
Author

albanx commented Jan 22, 2015

Yes actually I know that, I had some days headache about that, trying
different test and approaches, at first I thought I have done it but when I
added the third level it blow up in infinite loop.

Even it is not handy for the moment yours is the best method for
performance. John Resig one is nice but very slow. I have notice that big
libraries like Ckeditor uses some even more slow definition of class, but
actually very rare in their code. Most of their code is based on pure
prototype.

On Thu, Jan 22, 2015 at 5:39 PM, Jie Meng-Gérard [email protected]
wrote:

Thanks Alban!

the _"this.parent.setAddress.call(_this, 'France', city, street);" syntax
doesn't work if there are more than 2 inheritance levels (infinite loop).
The access to the parent constructor must be static (no "this").

See more in the section "Extend a class" of
http://jiem.github.io/my-class/

Cheers

On Thu Jan 22 2015 at 8:06:33 AM Alban [email protected] wrote:

Hi
Actually this is the simple and best performance class definition in
javascript. I have analised it and compared with other javascript libs.
Now in my opitionion the best would be to simplyfy parent method access
from child. For example: if now it is
Child.Super.prototype.setAddress.call(this);
make something like this:
this.parent.setAddress.call(this, 'France', city, street);

I will try to do that.

Reply to this email directly or view it on GitHub
#8.


Reply to this email directly or view it on GitHub
#8 (comment).

www.albanx.com
www.albanx.com/ajaxuploader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants