|
|
|
|
|
by viraptor
5126 days ago
|
|
I'd still stand by the opinion that the browser in GBA is the same level of complexity as GBA in browser. They're interpreters of some code essentially (one of GBA roms, the other of html/js). There is of course a different human complexity of "how hard would it be to implement"... but if we're adding JS engine to the mix, the browser may be actually harder. With classes / prototypes (sorry for wibbly wobbly explanation, my CS is not good enough to use the proper terms, which probably exist out there), you can pretend there's a "behaves like" relationship. To simulate a prototype using a class you have to build the freely accessible dictionary and initialisation/cloning semantics level inside of the class. To simulate classes using a prototype... that depends on your definition of a class. Dynamic dispatch is already there, encapsulation too, subtypes just need a field specifying the name and cloning the right prototype, inheritance is on by default. Self-referencing is usually in there too. So in my opinion classes can be substituted by prototypes in a large number of cases. Classes however need another layer on top to act like prototypes. So prototypes look like more primitive than classes and classes look like a special-cased version of prototypes. Then again, it's late here, so maybe I missed something obvious... |
|
A prototypical inheritance model can express a larger range of constructs than a class based inheritance model can, and this is normally called expressiveness. Its actually difficult to say which one is more "primative" (by your definition of primative), because they are actually both on a similar layer.