News for hackers. Stuff that matters.
Re:Prototypes Are Not Classes by masklinn on Sunday January 19, 2014 @02:09PM (#7085512)
I'm not sure that's a good idea, because then they'd be made very sad by constructors, by prototypes being something completely different[0], by not having mixins[1], by single-inheritance, by dynamic inheritance[2], by the lack of blocks (and non-local returns), etc…

Essentially, by javascript not being a very good Self.

[0] IIRC in Self the prototype is the object you copy, objects linked through parent slots are either mixins or traits.

[1] although it doesn't have a lobby, which makes the difference between traits and mixins, js's prototypes are probably closer to self's traits.

[2] that's being added in ES6, yay. But still single, boo.

Re:Prototypes Are Not Classes by Pacabel on Sunday January 19, 2014 @03:49PM (#7085930)
I think that the claims that "JavaScript is like Self" or that "JavaScript is like Scheme" are attempts to legitimize what really isn't a very good language to being with. I think that this is also done out of ignorance, to a large extent. People hear about Scheme and Self being held in high regard, hear about some very vague similarities with JavaScript, and then assume that JavaScript is somehow like Scheme and Self, even if they've never used Scheme or Self. The supposed similarities only extend to JavaScript supporting anonymous functions and closures (just like numerous other languages) in the case of Scheme, or merely just sharing some terminology with Self. So there isn't any real basis to these claims.
Re:Prototypes Are Not Classes by raganwald on Sunday January 19, 2014 @04:22PM (#7086044)
I think that the claims that "JavaScript is like Self" or that "JavaScript is like Scheme" are attempts to legitimize what really isn't a very good language to being with.

I think it can be helpful to say that JavaScript is "like" Scheme if the purpose is to think harder about JavaScript and some of the consequences enabled by its features. On the other hand, I don't think JavaScript really is a Lisp, and it's a terrible idea to say so for the purpose of justifying all of its design choices.

http://raganwald.com/2013/07/19/javascript-is-a-lisp.html

Re:Prototypes Are Not Classes by pjmlp on Sunday January 19, 2014 @04:58PM (#7086194)
I am aware of that.

On my case, the remark I made had more to do with the fact that many developers tend to be unaware that these concepts also exist in other languages and could learn a bit by seeing them on the languages they originated from.

Even when JavaScript only took tiny details from them.

Re:Prototypes Are Not Classes by angersock on Sunday January 19, 2014 @02:26PM (#7085580)
MI still sends shivers down my spine, having spent time in the C++. Just say no.
Re:Prototypes Are Not Classes by clhodapp on Sunday January 19, 2014 @02:36PM (#7085620)
So C++ got multiple inheritance wrong... That doesn't mean it must be rejected in all cases.
Re:Prototypes Are Not Classes by angersock on Sunday January 19, 2014 @03:37PM (#7085888)
What are the cases where MI is better than mix-ins or component architectures?
Re:Prototypes Are Not Classes by raganwald on Sunday January 19, 2014 @04:25PM (#7086061)
NewtonScript had a neat concept of heterogeneous multiple inheritance: Its "objects" had a prototype-like inheritance chain and a container inheritance chain.

If client-side JavaScript had this design, there would be no need for the DOM to have a special event mechanism that lives outside of method handling: DOM elements would simply have method handlers and the dispatch system would handle prototype and container inheritance.

Re:Prototypes Are Not Classes by lispm on Sunday January 19, 2014 @05:58PM (#7086446)
> NewtonScript had a neat concept of heterogeneous multiple inheritance: Its "objects" had a prototype-like inheritance chain and a container inheritance chain.

See also HyperCard/HyperTalk...

Re:Prototypes Are Not Classes by pjmlp on Sunday January 19, 2014 @03:59PM (#7085967)
Maybe just in some corner cases.

However Eiffel, OCaml and Python MI implementations seem to be implemented in a more sane way.

Re:Prototypes Are Not Classes by mtraven on Monday January 20, 2014 @01:49AM (#7087953)
CLOS
Re:Prototypes Are Not Classes by masklinn on Sunday January 19, 2014 @04:44PM (#7086128)
Beware, Self inheritance is not class-based inheritance, and thus Self MI has very little relation to C++'s MI.
Re:Prototypes Are Not Classes by roel_v on Monday January 20, 2014 @05:38AM (#7088768)
OK, I'll bite. Please tell me what exactly your problem was.