DEV Community

Discussion on: Is Javascript a compiled language?

 
genta profile image
Fabio Russo

I see...

On yesterday, after this post, I was looking around for more info.
I found the "You don't know JS" book, pretty similar in description about this argument:
link to Git Page

It may be self-evident, or it may be surprising, depending on your level of interaction with various languages, but despite the fact that JavaScript falls under the general category of "dynamic" or "interpreted" languages, it is in fact a compiled language.

What's your idea about this? I'm curious, because in many ways, It seems that anyone is correct about this "compiled or not" discussion.

Thread Thread
 
lexlohr profile image
Alex Lohr

There is a gray area in which this discussion happens: virtual machines like .NET or the JVM.

One could make the case that code that runs on such a VM is also compiled, since the "bare metal" on which the actual code runs is just behind a small abstraction layer to allow independence from actual hardware implementation.

But here's the issue I have with the assertion that JS was a compiled language: if your language requires you to start a JIT compiler during run time in certain cases, you're disqualified from calling yourself "a compiled language", because then you go back to interpreter mode.

Granted, that shouldn't happen with most modern JavaScript code, but the language itself is a modern one that is still compatible with all of its bad parts.

Thread Thread
 
genta profile image
Fabio Russo

Granted, that shouldn't happen with most modern JavaScript code, but the language itself is a modern one that is still compatible with all of its bad parts.

Sure, but, there are too many code based on those "bad parts".
By fixing It, you will break lots of stuff all around the web.

Thread Thread
 
lexlohr profile image
Alex Lohr

That's why I refrain from calling JavaScript a compiled language. Please let's not break the web.

Thread Thread
 
qm3ster profile image
Mihail Malo • Edited

Yes, the fact new Function() doesn't capture scope makes it much better optimized, but both are still bad for security (esp in web) and performance.

Can't wait for native DOM access in WASM.

Let's break the damn web already!