Wednesday, July 11, 2012

When somebody tries to explain JavaScript's prototype system

4 comments:

  1. It would be less confusing if JavaScript followed Self's terminology instead of redefining "prototype" to mean "traits".

    ReplyDelete
  2. The dude inventing it should have just said to himself, "I am clearly out of my league here. I will provide first-class functions and allow people to roll their own object systems."

    Not ideal, but enormously better than every web developer on the planet going through the contortions of that poor soul in the post.

    ReplyDelete
  3. The dude inventing it did so in great haste, and under the strange constraint that it needed to look like Java. It used its OO features heavily, so leaving them as an exercise for the user was not an option. The resulting Self-disguised-as-Java is an excellent general-purpose-language-as-DSL; it looks bad only because it became popular before its bugs could be fixed.

    ReplyDelete
  4. it not only looks bad, it is horribly designed. there is no good excuse. there just isn't. contemplate "this" for a moment.

    ReplyDelete

Real names (or handles), please. Anonymous comments are likely to be ignored.