On Dec 24, 5:46 pm, fernando trasvina <[email protected]> wrote: > What crockford is trying to point is that you should not think as the new > operator as the classical use of new > you should think of it as the prototype pattern, and this is not in conflict > in any way with the Object.create method
I don't see where he points that out. > Object.create is good for creating inheritance hierarchies > new is good for creating instances that need an initializer function in this > case known as constructor function. > I don't see how Object.create wins you much in this regard alone over a constructor. it breaks the instanceof relationship, which means you have to check for the existence of a members manually, or by using the isPrototypeOf method which could be shadowed. > with the case of super you don't need it because you cannot (even when there > are implementations that provide a way to do it) mutate the proto attribute > of an object, so you always know what object you come from. so What does a super call have to do with proto? Calling a method of a parent and augmenting it for the more specific instance isn't something never needed. > you should follow the language idioms and not invent new ones because you > don't understand something or because you don't like it, Since when was there an idiom? Inheritance isn't even consistent in the language. > neither because you are trying to port the idioms from other languages. > well that is my point of view. At no point in this discussion have I advocated porting some other language's inheritance model. -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
