Live data from Hacker News

The surprising rise of JavaScript

radar.oreilly.com

31–39 of 39 posts

Re: The surprising rise of JavaScript

#31

Earlier quoted context omitted.

> Awesome: prototypes Meh. I still have to write that rant, but javascript's "prototypes" are a boondoggle, they've got nothing to do with Self's prototypes[0] and don't provide anything more than classes do in nice dynamic languages (you can, in fact, do more fucking around with Python's types than with Javascript's prototypes). For all intents and purposes, Javascript's so-called prototypes are shitty single-inheri…

> don't provide anything more than classes do in nice dynamic languages How would you do in-place method mutation in something like Python or Ruby?

In Ruby:

    foo = "Hello"
    def foo.to_s; "Hello world!" end
Because "def" introduces a new local variable scope, you'll have to use #define_singleton_method if you want to close over variables:

    foo = "Hello"
    old = foo.method(:to_s)
    foo.define_singleton_method(:to_s) { old.call + " world!" }

Re: The surprising rise of JavaScript

#32
post #21

JavaScript is a strange beast. The semantics of the language are, in my opinion, awesome and awful in different ways. Awesome: prototypes, first-class functions, dynamic function scope (not sure if there's a proper name for this), jQuery. Awful: the this keyword is confusing (but powerful once you learn it), type coercion, the API. The standard API is the reason that people care about "the good parts" of JavaScript.…

> the document.getElementById sort of operation which looks like it was designed in 10 days (all due respect to Brandon Eich) document.getElementById() isn't part of JavaScript but part of the DOM Level 2 spec that came out years after JS. JS was first seen in Netscape 2.0 in 1995 whereas DOM level 1 was specified in 1998 but didn't in fact yet contain document.getElementById. That one was added in DOM Level 2 in 200…

Ah, my bad. Next time I will do more research before running my mouth.

Re: The surprising rise of JavaScript

#33
post #27

Earlier quoted context omitted.

> Awesome: prototypes Meh. I still have to write that rant, but javascript's "prototypes" are a boondoggle, they've got nothing to do with Self's prototypes[0] and don't provide anything more than classes do in nice dynamic languages (you can, in fact, do more fucking around with Python's types than with Javascript's prototypes). For all intents and purposes, Javascript's so-called prototypes are shitty single-inheri…

While you're generally right, you must not forget about Harmony Proxies and all that meta-programming fuzz. While the final result of a prototypal class hierarchy is in fact very similar to pseudo-classic inheritance, remember that it's just the result of an internal, manual, modifiable process.

> While you're generally right, you must not forget about Harmony Proxies and all that meta-programming fuzz.

All of which (and more) is available in class-based dynamically typed languages

Re: The surprising rise of JavaScript

#34

Earlier quoted context omitted.

> Awesome: prototypes Meh. I still have to write that rant, but javascript's "prototypes" are a boondoggle, they've got nothing to do with Self's prototypes[0] and don't provide anything more than classes do in nice dynamic languages (you can, in fact, do more fucking around with Python's types than with Javascript's prototypes). For all intents and purposes, Javascript's so-called prototypes are shitty single-inheri…

> don't provide anything more than classes do in nice dynamic languages How would you do in-place method mutation in something like Python or Ruby?

Could you explain what you mean by "in-place method mutation"? With an example in javascript maybe? Is it just about adding or replacing a method on a type (or an instance), or do you mean something more complex?

Re: The surprising rise of JavaScript

#35

Earlier quoted context omitted.

> Awesome: prototypes Meh. I still have to write that rant, but javascript's "prototypes" are a boondoggle, they've got nothing to do with Self's prototypes[0] and don't provide anything more than classes do in nice dynamic languages (you can, in fact, do more fucking around with Python's types than with Javascript's prototypes). For all intents and purposes, Javascript's so-called prototypes are shitty single-inheri…

> For all intents and purposes, Javascript's so-called prototypes are shitty single-inheritance classes without the sugar. You're right. I would much rather have Java's or C++'s inheritance models in JavaScript. JS's object model is mutable, which is a plus for me, but it is far only language with mutable object methods or properties. I'll have to move prototypes from the "awesome" pile into the "meh" pile. > lexical…

> I am referring to the call and apply functions which allow the user to set the scope of the functions during the function call.

Ah yes, so it is indeed about `this` and its dynamic scoping.

I can't say I'm much fond of it, I'd rather have correctly bound methods (à la python) and actual, optional dynamic scoping when needed (à la Common Lisp)

> Very true, but I'd really like to know why you would put JS in the same class as Fortran and Cobol.

I don't, I'm just saying being able to do "a lot" with a language does not mean the language is good in and of itself, and Fortran and Cobol are good examples of that: few under 50 will try and defend them (as opposed to PHP, an unmitigated disaster of a language which still finds defenders), and there are fucktons of code written in these languages and still running.

Re: The surprising rise of JavaScript

#37

Earlier quoted context omitted.

Similar story for me. Except that in 2010 I re-learnt JavaScript and discovered how beautiful, flexible and powerful it can be as a client side / server side language

I've been node'n it up a bit myself lately. The language is easy to write, pretty easy to get things done, and server-side node provides a lot of great libraries. That said, the development ecosystem around Javascript is very immature. To really write decent amounts of server-side JS as a team, people often employ linters and other things to sanity check their code. Debugging? Mostly printf's (or equivalent). Scoping…

Have you not seen [1] node-inspector? It allows you to debug your server side code with the chrome/safari web inspector.

[1] https://github.com/dannycoates/node-inspector

Re: The surprising rise of JavaScript

#38

Earlier quoted context omitted.

I've been node'n it up a bit myself lately. The language is easy to write, pretty easy to get things done, and server-side node provides a lot of great libraries. That said, the development ecosystem around Javascript is very immature. To really write decent amounts of server-side JS as a team, people often employ linters and other things to sanity check their code. Debugging? Mostly printf's (or equivalent). Scoping…

Have you not seen [1] node-inspector? It allows you to debug your server side code with the chrome/safari web inspector. [1] https://github.com/dannycoates/node-inspector

Adrian - I have and it is a very useful tool. I guess my main gripe is the fact that the tool set is there in some form, but each has its area and none of them are really connected/integrated.

I suspect the toolchain will eventually get there, but it is a big step back if one is used to more integrated ecosystems.

Re: The surprising rise of JavaScript

#39
post #21

JavaScript is a strange beast. The semantics of the language are, in my opinion, awesome and awful in different ways. Awesome: prototypes, first-class functions, dynamic function scope (not sure if there's a proper name for this), jQuery. Awful: the this keyword is confusing (but powerful once you learn it), type coercion, the API. The standard API is the reason that people care about "the good parts" of JavaScript.…

> the document.getElementById sort of operation which looks like it was designed in 10 days (all due respect to Brandon Eich) document.getElementById() isn't part of JavaScript but part of the DOM Level 2 spec that came out years after JS. JS was first seen in Netscape 2.0 in 1995 whereas DOM level 1 was specified in 1998 but didn't in fact yet contain document.getElementById. That one was added in DOM Level 2 in 200…

Actually it was in DOM1 HTML and moved to Core in DOM2.
Post reply on HN