samedi 31 janvier 2015

Why many duck-typed dynamic programming languages would use class-based approached instead of prototype-based OOP?


Since quite many dynamic programming languages have the feature of duck-typing and they can also open up and modify class or instance methods at anytime (like ruby and python), then…


Question 1) What’s the need for a Class in a dynamic language? Why the language is designed that way to use a class as some kind of “template” instead of do it the prototype-way and just use a object?


Also javascript is prototyped-based, but coffeescript (the enhanced version of js) chooses the class-based way. And it goes the same for lua (prototyped-based) and moonscript (class-based). In addition, there’s class in ES 6. So…


Question 2) Is it suggesting that if you try to improve a prototype-based language, among other things, you should change it to class-based? If not, why is it designed that way?





Aucun commentaire:

Enregistrer un commentaire