I seriously wonder what kind of circumstances lead someone to be this irrationally devoted to such a flawed and outclassed language. Probably best if I just block you though…
I seriously wonder what kind of circumstances lead someone to be this irrationally devoted to such a flawed and outclassed language. Probably best if I just block you though…
Go to bed, you’re drunk.
I’ve never done it but apparently you can actually gradually transition to Typescript one file at a time by renaming them from .js
to .ts
. Might help a bit. Good luck anyway!
Yeah IntelliJ does amazingly without type annotations but even it can’t do everything. E.g. if you’re using libraries without type annotations, or if you don’t call functions with every possible type (is your testing that good? No.)
Static types have other benefits anyway so you should use them even if everyone in your team uses IntelliJ.
In common usage a linter detects code that is legal but likely a mistake, or code that doesn’t follow best practice.
Although static type checkers do fit in that definition, that definition is overly broad and they would not be called a “linter”.
Here is how static type checkers describe themselves:
Pyright is a full-featured, standards-based static type checker for Python.
Mypy is a static type checker for Python.
TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.
Sorbet is a fast, powerful type checker designed for Ruby.
Here is how linters describe themselves:
Pylint is a static code analyser for Python 2 or 3. … Pylint analyses your code without actually running it. It checks for errors, enforces a coding standard, looks for code smells, and can make suggestions about how the code could be refactored.
(Ok I guess it’s a bit redundant for Pylint to say it is a linter.)
Eslint: The pluggable linting utility for JavaScript and JSX
Clippy: A collection of lints to catch common mistakes and improve your Rust code.
Ruff: An extremely fast Python linter and code formatter, written in Rust.
You get the idea… Linters are heuristic and advisory. Quite different to static type checking.
Honestly I would take a look through a good standard library that provides a lot of algorithms (e.g. C++ or Rust). That has the basics, especially for data structures.
Also have a go at some hacker rank tests. Especially if you want to learn dynamic programming (abysmal name), they absolutely love that.
Linters 100% won’t. A static type checker is not a linter.
Yes because you used static type annotations. This thread was about code that doesn’t use static types (or static type annotations/hints).
It’s an example to demonstrate that linters cannot reliably detect variable name typos - you need static types. None of the stuff you mentioned is relevant.
The typo in your example is also undetectable by linters. I think you’re missing the point.
What’s awful about this example? The only thing I do is access an object member. Does your code not do that??
Yes you can use static type hinting and the static type checker (Mypy or Pyright) will catch that. Linters (Pylint) won’t.
If you use VSCode, open both files and then ctrl-shift-P “Compare active file with …”
You’re welcome.
def foo(x):
return x.whatevr
No linter is going to catch that.
…for people who refuse to use static types.
Hilarious.
This is the sort of thing you have to learn by experience, like how you can’t really learn good coding taste from reading a list of rules (though some lists are helpful).
Anyway in my experience documentation is quite different in public (i.e. seen by customers) and private (inside your company). For internal stuff there’s a much smaller incentive to document things because:
I think the best thing to do is to accept that people aren’t going to expect documentation internally. There’s zero point writing guides to tools on your company wiki or whatever, because nobody will even try to look for it - they’ll assume it doesn’t exist.
Instead you should try to keep your documentation as close to the user as possible. That means, don’t have a separate docs
folder in your repo - put your docs as comments in the code.
Don’t put deployment instructions on your wiki - add a ./deploy.sh
script. It can just echo the instructions initially.
Yeah, honestly you should stick to if/else until you’re really sure you want to do something more complex.
This is really terrible advice. Sometimes it’s better to do that, but definitely not in the example from this article.
If anyone says you should always prefer polymorphism to switches they are a bloody idiot.
☝ this is why Linux will never be mainstream
Wow look at that CUPS code and tell me with a straight face there aren’t 5 more similar vulnerabilities waiting to be found…