Inheritance doesn't work

46 views
Skip to first unread message

Benoît Léo Maillard

unread,
Feb 3, 2015, 12:27:15 PM2/3/15
to rapyd...@googlegroups.com
Hi everybody,

I experienced an issue with rapydscript's inheritance. This is my rapydscript code (this is just a basic example, not my real project): http://rapydscript.pyjeon.com/?q=KEbkTV

This doesn't work, because the compiled code results in infinite recursion.

However, it works great when I use the rapydscript version installed on my computer (installed a few months ago). This is what I get:

(function(){
function _$rapyd$_extends(child, parent) {
    child.prototype = Object.create(parent.prototype);
    child.prototype.constructor = child;
}
var o;
function Object1(){
    var self = this;
    self.x = 0;
};


function Object2(){
    var self = this;
    Object1.prototype.constructor.call(self);
};

_$rapyd$_extends(Object2, Object1);

Object2.prototype.show_x = function show_x(){
    var self = this;
    console.log(self.x);
};

o = new Object2();
o.show_x();
})();

Could you please fix that bug or tell me what is wrong ? Thank you very much !

Alexander Tsepkov

unread,
Feb 3, 2015, 7:41:31 PM2/3/15
to Benoît Léo Maillard, RapydScript
Yea, that was silly of me, surprised the class tests didn't catch this. I'll fix it.

Alexander Tsepkov

unread,
Feb 3, 2015, 11:11:16 PM2/3/15
to Benoît Léo Maillard, RapydScript
Pushed a commit that should fix this bug.

Benoît Léo Maillard

unread,
Feb 4, 2015, 4:12:29 PM2/4/15
to rapyd...@googlegroups.com, benoitleo...@gmail.com
Thanks, it works perfectly !
Reply all
Reply to author
Forward
0 new messages