DEV Community

Ryan Westlund
Ryan Westlund

Posted on

Javascript the compiled language

Something I've been thinking about lately. Modern Javascript development normally requires a build step, if nothing else then just to resolve module imports. In other words, Javascript no longer has the benefits of interpretation. It's effectively a compiled language, but without any of the benefits that normally come with that, like performance, type checking, and library interoperability.

Discussion (16)

Collapse
pentacular profile image
pentacular

"Compiled language" and "interpreted language" are category errors.

Compilation is an implementation strategy -- any language can be compiled or interpreted.

There are C interpreters and there are python compilers.

Collapse
yujiri8 profile image
Ryan Westlund Author

Sure, alternate implementations exist, but they're never as reliable as the standard ones.

Collapse
pentacular profile image
pentacular

I'm not sure what that has to do with anything.

Collapse
zilti profile image
Daniel Ziltener

I mean, Javascript tries to be a lot of things without having any of the benefits of these things, so that shouldn't be surprising to anyone really

Collapse
patarapolw profile image
Pacharapol Withayasakpunt

Usually, actually.

If you want to use proposals, you will probably need a build step / polyfills.

Not to mention not everyone use lastest Browser / Node / Electron.

yujiri8 profile image
Ryan Westlund Author

I don't see anything there that deals with bare import resolution, but I'll have to do more investigation later

Thread Thread
easrng profile image
easrng

The thing is, without something like skypack/pika (npm CDN/kinda bundler thing), there are no module names. A module is at it's URL, and no resolution is needed.

Thread Thread
easrng profile image
easrng

So, compilation is only needed for interop with the npm ecosystem.

Thread Thread
yujiri8 profile image
Ryan Westlund Author

Interop with the NPM ecosystem is essential though. We need to be able to use JS libraries from NPM.

Thread Thread
easrng profile image
easrng

So use JSPM.dev or skypack.dev or snowpack etc

yujiri8 profile image
Ryan Westlund Author

I'm not sure if that actually removes the need for compilation since module names still need resolution to a URL to import, right?

Collapse
yujiri8 profile image
Ryan Westlund Author

Are mainstream browsers legacy runtimes? Or is there now a built-in solution to module imports that I haven't heard of?