Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> And it's true. Look at the mocking libraries for JavaScript. They're sooooooooo much easier to write than anything for classical languages because it's so easy to do in JavaScript. In my own experience I have a mutli-user networking system written in JavaScript and a library in C#. To reimplement the same things in JavaScript in C# is a huge amount of code bloat. I have to make classes and meta classes and all kinds of other indirection just so I can make an Event system that is generic. In JavaScript that's 2 or 3 lines

That does not follow from what you quoted, and what you quoted is a non-sequitur to start with.

What you're raving about can be achieved just as easily in any dynamically typed language. Hell you probably get 80~90% of that in a structurally typed language (OCaml objects, Go).

> In JavaScript you can build objects on the fly.

Which you can do in many other languages, including statically typed ones. Here's an object in Ocaml:

    # let s = object
        val mutable v = [0; 2]

        method pop =
          match v with
          | hd :: tl -> 
            v <- tl;
            Some hd
          | [] -> None

        method push hd = 
          v <- hd :: v
      end
And that's statically typed.

> The problem with 'class' in ES6 is that it will prevent people from learning this new, easier, faster, simpler way of working because instead they just bring the classical baggage to JavaScript.

That's patent nonsense, not to mention ES6's class shortcuts apply to object literals as well, the only thing the class statement does is remove the bullshit and mostly useless boilerplate Javascript demands when creating a reusable prototype due to it being a garbage language, and its "prototypal" object system being there not because it's good and going to save the masses but because it was the easiest way to have an object system working in a week. It's just a sad and pitiful shadow of Self's object system from which it draws so little you have to know the relation's there to find it.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: