I see mypy more as a refactoring tool, but I'm always pleasantly surprised when it catches issues. It caught a bug here!
demo.py:96: error: Unsupported operand types for >= ("int" and "Optional[int]")
(In the code I've checked max_val is not None, but used min_val.)
miniblog.
Related Posts
I'm having fun writing a simple type checker, but I'm learning firsthand why syntax-directed checking doesn't work. It prevents inference.
My checker catches real bugs, but it can't handle cases like this:
[1, 2].map(fun(x) { x + 1; })
I think I need bidirectional checking.
Arrays being truthy in JS still catches me out sometimes.
In Python or Lisp, empty lists are falsey and truthiness is safe and idiomatic.
I'm glad that 0567 as syntax for octal literals has fallen out of fashion in newer PLs. It's a footgun that catches out experienced devs.
