4 ms·
It took me a while to get it, especially since the new keyword makes matters really confusing. But after reading about the language Self, I am really using prot
by pom 15y ago
It took me a while to get it, especially since the new keyword makes matters really confusing. But after reading about the language Self, I am really using prototypal inheritance, and no more of the "new" business for me.
- munificent 15y agoGot any public code? I'd like to see examples of non-class-style JS code.
- pom 15y agoYou can have a look at: https://github.com/julienq/spqr/blob/master/populus.js https://github.com/julienq/spqr/blob/master/populus.js Bear in mind that it's still a work in progress. Look for "populus.object", especially create(), is_a() and call_super(). There is still something called $new (not new because some picky parsers don't like it) but it's just the chaining of create() (a wrapper around Object.create()) and init().