Hacker News new | ask | show | jobs
by simonw 877 days ago
"I’d have to set up some CI with the type checking step and make it impossible to deploy the code that doesn’t pass it, maybe."

Yes. That's how people successfully use type checking in Python.

1 comments

I did that for Python, and now I do it for PHP as well.

Trivial to set up but ends up being a huge time saver, especially when reviewing junior colleagues code - don't even ping me to review your code until you've managed to convince the static analyzer it will work!

Re: junior colleagues, do you not instead arrive at "why does the static analyzer complain", or worse, an avoidance of proper types that you then have to point out in review?
You definitely do, for the first few times.

But after that they learn to write code which makes both the static analyzer and the reviewer happy, and such code tends to be much more maintainable down the line.

When you don't have strict typing discipline enforced by the CI, you will likely have to enforce it manually anyway because projects in a gradually typed language without simple types enforced tend to become a complete mess IMO.