News for hackers. Stuff that matters.
Re:How Javascript Prototypal Inheritance Really works by olavk on Sunday May 29, 2011 @09:21AM (#2596580)
I think you are conflating static typing with class-based OO. Python for example is class-based but still fully dynamic. You can mutate classes at runtime, and even replace the class of an instance at runtime, OTOH Python cannot do the slot lookup optimization you speak of, due to its dynamical nature. Python shows that class-based inheritance is very useful (and easy to use) in a dynamic language.
Re:How Javascript Prototypal Inheritance Really works by SeanLuke on Sunday May 29, 2011 @09:31AM (#2596596)
I believe you may have picked the one language which inadvertently illustrates my point.

My understanding is that Python does these things because it's in the SAME bag as JavaScript: it's actually a proto language in implementation down deep, but with a class-based syntax, thus inheriting the disadvantages of both and the advantages of neither. There's some dynamicism bubbling up from the object implementation but it's a far cry from the elegance of a real proto language. I do not know why Guido chose to do this awful thing, but he is at least to be excused given the age of the language. JavaScript has no such excuse.

Re:How Javascript Prototypal Inheritance Really works by olavk on Sunday May 29, 2011 @11:34AM (#2596812)
I guess you could argue that Python is a prototype language deep down because it performs property lookups at runtime by following a chain of objects. (Those objects just happen to be classes.) But by that definition, other dynamic OO languages like Perl or Ruby is also prototype languages.

If you think of classes in Python as a feature build on top of prototypal inheritance, then it has certainly proved a very useful feature.

Re:How Javascript Prototypal Inheritance Really works by DmitrySoshnikov on Sunday May 29, 2011 @04:32PM (#2597515)
Exactly, Python is a "prototype-based" language with first-class classes as sugar; similar to Coffee. I gave a link below where kinds of classes are described.
Re:How Javascript Prototypal Inheritance Really works by SeanLuke on Monday May 30, 2011 @10:10AM (#2599417)
My understanding is that, unlike Python and JavaScript, Ruby has a true class-based OO system. Can't speak to Perl.
Re:How Javascript Prototypal Inheritance Really works by olavk on Tuesday May 31, 2011 @07:09AM (#2602110)
That is interesting, I don't know Ruby that well. But by what definition is Python not a "true" class based OO-system?