Andrey (azangru) wrote,

This guy (an associate professor at the University of British Columbia) is classifying JavaScript as a compiled language:

The reason? He is arguing that an interpreted language will execute the code line by line, and if at the current line of execution a variable is used in an expression but nothing has been assigned to it (e.g. a function is called but the function assignment statement happens in the line below), the interpreter will throw an error. In contrast, in JavaScript, functions can be declared in the source code after the lines where they are called (as in the image below). He explains this by the fact that the code gets compiled before execution:

Here is what he is saying: "Now, while JavaScript was initially a strictly interpreted language, it no longer is today, because this code [points at the sample inside the frame] actually works, even though m1 has not been declared at the beginning of this program. The way this works in reality is every browser is using JIT compilation to compile JavaScript code into byte code that can then be executed by the browser's JavaScript engine."

Now, either this guy has not heard of hoisting — the rules for treatment of var and function statements in JavaScript by the runtime — or hoisting of functions and vars became possible only after the introduction on JavaScript JIT compilers. I am not sure which, but very strongly suspect that it's not the latter. In which case his argument completely falls apart.

  • (no subject)

    Thought of this phrase today for some reason, then thought whether it exists in English (putting toothpaste back into the tube came to mind), then…

  • (no subject)

    I think many (perhaps most) people are totally fine with being a free-rider, a bludger, or a sponge (remember Trump who said that he pays little…

  • (no subject)

    Someone who self-identifies as a technical writer, among other things, begins her article How To Build An E-Commerce Site With Angular 11, Commerce…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.