4 ms·
> it's less powerful Actually, in some ways, JS-style prototype-based inheritance is more powerful. You can emulate class-based inheritance, but you can also u
by wanorris 19y ago
> it's less powerful
Actually, in some ways, JS-style prototype-based inheritance is more powerful. You can emulate class-based inheritance, but you can also use a variety of other models, such as adding in only a single specified method from another class or adding in capabilities on a per-object basis instead of per-class.
Yes it's different, and maybe it's a pain to use -- especially if what you want is for it to be language x (for some value of x) -- but I don't understand how you can justify the claim that it's less powerful.
- maxwell 19y agoClasses vs. prototypes is just static vs. dynamic inheritance. You'll generally have the same arguments as those between static and dynamic typing. They're both "powerful" in their own right: static code tends to be faster to run, dynamic code tends to be faster to write. Depends on which you value more in a given circumstance.