Andrey (azangru) wrote,
Andrey
azangru

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.
Subscribe

  • (no subject)

    Is it ... Bill Maher? Is he, in the penetrating eyes of this insightful lady, the emblem of white supremacy now? The comments to the tweet say it…

  • (no subject)

    Also, Google's documentation style guide. With the latest trends about the correct language, obvi. This one via HN.

  • (no subject)

    Google's document on how they build Chrome dev tools with web components. And yeah, it includes a special dance for some semblance of type safety,…

  • Post a new comment

    Error

    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.
  • 0 comments