> Brett Patterson wrote: > I am in the middle of a conversation with this guy who says that JavaScript > is an object-oriented language. Is he correct? Could you please site some > references?
There's many different things people mean when they talk about object orientation. If they talk about the Java mode of object orientation, then JavaScript isn't object oriented but is pretty close. On the other hand, if they talk about the Self mode of object orientation, then JavaScript is definitely object oriented, while Java has it's flaws. There is no single definition that people agree on, only an arbitrary number of points on a list where no single language uses a metaphor that covers them all. Everything in JavaScript is an object. Objects inherit in a run time delegation fashion from other objects in the prototype chain, a model inspired by Self. Types are placed on values, not variables, but everything has a type. Encapsulation comes from closures. 2008/10/24 Anthony Ziebell <[EMAIL PROTECTED]>: > JavaScript is commonly referred to as 'object-orientated' but really, > JavaScript is 'prototype-based'. They do have different meanings, but have > some similarities... Class based inheritance is not necessary for a language to be object oriented. Prototype delegation as mode of inheritance is less common as language designs go, but it's just as powerful if not more so. Above all, JavaScript is an object based language. It has imperative and functional properties, it has a statement-expression curlies-and-semicolons, it has object orientation and higher order programming features, it has reified closures and lexical scope with a few dynamic scope features etc. It's a hybrid language. But it does have object orientation. -- David "liorean" Andersson ******************************************************************* List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *******************************************************************
