"Typed language? Yeah, I'm using a keyboard."
Programmer Humor
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
I am currently teaching python and JavaScript devs Typescript. Everytime they hit a problem they switch to any
Sigh
Must be the same people who just comment out failing unit tests.
"Your crappy tests are failing again on my branch. I've commented them out until you fix them."
Sadly that sort of thing got so common where I work that I'll run the tests three times before considering looking into the error message to see if it is something I broke.
From time to time we take some days just to fix tests with inconsistent results, but there's always more popping up.
Yeah, we have a team whose job is to make sure all our tests run well and fixing them if they don't
...or skip em
the beatings will continue until typing improves
That's why I kinda don't like Python and JavaScript anymore. Every time I want types for a library it's gonna take me time to get it working. For every serious project I do, I use a strongly typed language.
Eslint is your friend :)
Just create a al Inter rule that rejects Any types and a pre-commit hook that refuses the commit if the linter fails. Sometimes the brute force approach is the best way to teach
You told them not to?
I am happy there is no obvious "any" type in Rust.
There is, it's just not easy to use
Does it compile???
... Compile???
i like when my strongly typed language can type itself, why should i have to type extra words because the compiler is stupid?
So that next time your coworker uses the wrong type, the compiler can scream at him: "NO I WONT COMPILE THIS YOU DUMBASS, LOOK JOHN SAID ON LINE 863 THAT IT SHOULD BE A DOUBLE, NOT A FLOAT FOR FUCK SAKE"
Tell me you are a Java dev without telling me you are a a Java dev 😂
As a JS dev, I can only wish we had those types 🥲
you can still have that without having to declare the type manually. check out Swift or OCaml for example
And if you have linter rules preventing any
as a boundary type you just use Record<String, any>
.
I mean that is the first step. ¯_(ツ)_/¯ The next step is to start defining the types more strictly than any.
Hmmm a more reasonable first step would be to just not even type anything until you're ready. But TS makes it hard to iteratively type parts of your codebase over time. One could type using JSDoc syntax for these cases, though.
Yeah, true
Well, you can always just add the type definitions later on.
I did port some C code to D, by just pasting it in a D file, then fixing the differences (changing type names, rewriting precompiler macros with D metaprogramming and inline functions, etc.).
typescript is not a strongly typed language