Hacker News new | comments | show | ask | jobs | submit login

Let's just phrase this analogy explicitly:

x86 assembly language is to an x86 processor as; JavaScript is to ??

So in this case it would be wrong to say that "??" is the JavaScript interpreter, because assembly language is a representation of machine code - it's basically an set of labels attached to binary numbers right?

The x86 processor executes machine code (I think actually some of the "backwards compatibility" in an x86 processor is provided by a scripting-like-language implementation on the chip but that's invisible to the assembly language programmer so not part of this discussion).

So I think you'd have to say that:

JavaScript is to a JavaScript interpreter as; x86 machine code is to an x86 processor


x86 assembly language is to x86 machine code as; ?? is to JavaScript

Now one could argue that CoffeeScript is the assembly language of JavaScript (I've not used it but it seems to be a roughly 1-to-1 mapping of one set of instructions to another, aliased for aesthetic purposes).

But getting back to the original analogy, I think it would be better stated as:

If you think of a web browser as a kind of computing platform for which we can write applications, then JavaScript is like the machine code that makes it run.

I think that makes sense - and it also makes sense to build higher level languages on top of JavaScript in that case, since increased computing power has always enabled us to get more done with fewer man-hours, why should this be any different?

You're really torturing the analogy there, aren't you?

Rather than take it literally, let's restate the analogy to better capture the intent: If you want your language to run on an x86 processor, you should compile it to x86 assembly and if you want your language to run in the browser, you should compile it to Javascript. Simply put.

There was a time when many "alternate" languages compiled to C instead of directly to assembly (e.g. early implementations of Eiffel). If this were still the trend today, then the analogy would better be stated as "Javascript is the C of the cloud".

(as an aside, I've been saying that "Javascript is cloud assembly" since late 2008...)

I think the first analogy is the right one, and I think I've got what's missing from it:

"x86 assembly language is to an x86 processor as; JavaScript is to the Web."


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact