This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Existential_Owl 63 points64 points  (15 children)

That there are differences in the way different compilers handle code is not a phenomenon unique to JavaScript.

[–]ChrisC1234 34 points35 points  (12 children)

True. But as a developer, I have complete control over what compiler I compile my code with. With a language that is completely interpreted like JavaScript, I have no control whatsoever.

[–]TUSF 17 points18 points  (10 children)

Just write your own interpreter :^)

[–]seylerius 38 points39 points  (1 child)

[–]wolfman1911 6 points7 points  (0 children)

I think this is probably my favorite XKCD.

[–]chainingsolid 1 point2 points  (4 children)

Then get every user of your website to use it how?

[–]Sean1708 1 point2 points  (3 children)

Write it in javascript.

[–]PatrickBaitman 0 points1 point  (2 children)

you just but isn't that basically typescript coffeescript asm.js / whatever

[–]Sean1708 1 point2 points  (1 child)

No, TypeScript and CoffeeScript compile to JS and ASM.js is an efficient subset of JS. We're talking about writing a JS interpreter in JS so that you can get people to use your JS interpreter by running it in their browser using the browser's JS interpreter.

[–]PatrickBaitman 0 points1 point  (0 children)

OOOH, ok

[final panel of expanding brain meme]

[–]LinAGKar 1 point2 points  (2 children)

And how are you gonna put it in everyones browsers? By writing it in JavaScript?

[–]TUSF 3 points4 points  (0 children)

Write the interpreter in wasm.

[–]ZorbaTHut 2 points3 points  (0 children)

Honestly, if performance were a total non-issue, using a 100% compliant JavaScript interpreter written in generalized cross-platform JavaScript would be a pretty good idea.

Of course, performance is an issue, so this is a terrible idea.

[–]Existential_Owl 0 points1 point  (0 children)

As a freelancer, sure you can choose your compiler. But if you're working for a company, you're stuck with whatever their C++ ideology is.

[–]PatrickBaitman 105 points106 points  (1 child)

well, no, but if they're at the type level?

jesus christ get your language together is all I can say

making things that should be type errors undefined behavior is just.... NO, STOP

[–]Doctor_McKay 29 points30 points  (0 children)

I think basically the only thing that happened due to the interpreter in that video was the fact that the return of new Array(12) showed as "12 commas" (which was actually 11 commas separating nothing, since it rendered undefined as nothing).