(no title)
voyou | 9 years ago
In both cases, you can share behaviour between objects by putting that behaviour in another object and attaching it in a special way to the objects that should have similar behaviour - in JavaScript it's called __proto__, in Python it's called __class__, etc. Python (and Ruby, Smalltalk, and others) introduce an additional "meta" level of shared behaviour between all these class objects, whereas JavaScript (and Self) don't, but that's a comparatively technical implementation detail. Most languages other than JavaScript are include slightly more language-level support for one particular pattern of using this shared behaviour, which gives users of these languages a strong hint as to how to use these capabilities.
The addition of a class keyword to JavaScript is good because it emphasises what JavaScript shares with other dynamic OO languages.
chickenfries|9 years ago