K, well configure your linter the way a professional Typescript environment should have it configured, and it will be there too. Not to be rude but not having a linter configured and running is a pretty basic issue. If you configured your project with Vite or any other framework it would have this configured OOTB.
Interpreted languages don’t have compilers, and one of the steps that compilers do is LINTING. You’re literally complaining about not configuring your compiler properly and blaming it on the language.
@masterspace Love the confidence, but your facts could do with some work.
“Interpreted language” is not a thing. Interpreted vs compiled is a property of a particular implementation, not the language.
(I wonder how you would classify lazy functional languages like Haskell. The first implementations were all interpreters because it was not clear that the well-known graph reduction technique for lazy evaluation could be compiled to native code at all.Today, hugs (a Haskell interpreter written in C) isn’t maintained anymore, but GHC still comes with both a native compiler (ghc) and an interpreter (runghc, ghci).)
Most implementations that employ interpretation are compiler/interpreter hybrids. It is rare to find an interpreter that parses and directly executes each line of code before proceeding to the next (the major exception being shells/shell scripts). Instead they first compile the source code to an internal representation, which is then interpreted (or, in some cases, stored elsewhere, like Python’s .pyc files or PHP’s “opcache”).
You can tell something is a compile-time error if its occurrence anywhere in the file prevents the whole file from running. For example, if you take valid code and add a random { at the end, none of the code will be executed (in Javascript, Python, Perl, PHP, C, Haskell, but not in shell scripts).
The original “lint” tool was developed because old C compilers did little to no error checking. (For example, they couldn’t verify the number and type of arguments in function calls against the corresponding function definitions.) “Linting” specifically refers to doing extra checks (some of which may be more stylistic in nature, like a /*FALLTHRU*/ comment in switch statements) beyond what the compiler does by itself.
If I refer to an undeclared variable in a Perl function, none of the code runs, even if the function is defined at the end of the file and never called. It’s a compile-time error (and I don’t have to install and configure a linting tool first). The same is true of Haskell.
What’s funny to me is that Javascript copied use strict directly from Perl (albeit as a string because Javascript doesn’t have use declarations), but turned it into a runtime check, which makes it a lot less useful.
@masterspace “Undeclared variable” is a runtime error.
Perl.
A) yes, that’s how interpreted languages work.
B) the very simple, long established way to avoid it, is to configure your linter:
https://eslint.org/docs/latest/rules/no-undef
I haven’t used Perl though, what do you like better about it?
@masterspace
“Undeclared variable” is a compile-time error.
K, well configure your linter the way a professional Typescript environment should have it configured, and it will be there too. Not to be rude but not having a linter configured and running is a pretty basic issue. If you configured your project with Vite or any other framework it would have this configured OOTB.
@masterspace
Yeah, if you’re a C programmer in the 1980s, maybe. But it’s 2006 now and compilers are able to do basic sanity checks all on their own.
Interpreted languages don’t have compilers, and one of the steps that compilers do is LINTING. You’re literally complaining about not configuring your compiler properly and blaming it on the language.
@masterspace Love the confidence, but your facts could do with some work.
“Interpreted language” is not a thing. Interpreted vs compiled is a property of a particular implementation, not the language.
(I wonder how you would classify lazy functional languages like Haskell. The first implementations were all interpreters because it was not clear that the well-known graph reduction technique for lazy evaluation could be compiled to native code at all.Today, hugs (a Haskell interpreter written in C) isn’t maintained anymore, but GHC still comes with both a native compiler (ghc) and an interpreter (runghc, ghci).)
Most implementations that employ interpretation are compiler/interpreter hybrids. It is rare to find an interpreter that parses and directly executes each line of code before proceeding to the next (the major exception being shells/shell scripts). Instead they first compile the source code to an internal representation, which is then interpreted (or, in some cases, stored elsewhere, like Python’s
.pyc
files or PHP’s “opcache”).You can tell something is a compile-time error if its occurrence anywhere in the file prevents the whole file from running. For example, if you take valid code and add a random
{
at the end, none of the code will be executed (in Javascript, Python, Perl, PHP, C, Haskell, but not in shell scripts).The original “lint” tool was developed because old C compilers did little to no error checking. (For example, they couldn’t verify the number and type of arguments in function calls against the corresponding function definitions.) “Linting” specifically refers to doing extra checks (some of which may be more stylistic in nature, like a
/*FALLTHRU*/
comment in switch statements) beyond what the compiler does by itself.If I refer to an undeclared variable in a Perl function, none of the code runs, even if the function is defined at the end of the file and never called. It’s a compile-time error (and I don’t have to install and configure a linting tool first). The same is true of Haskell.
What’s funny to me is that Javascript copied
use strict
directly from Perl (albeit as a string because Javascript doesn’t haveuse
declarations), but turned it into a runtime check, which makes it a lot less useful.None of that nitpicking changes the core point that they’re misconfiguring a dev environment and blaming the language.