Hacker News new | ask | show | jobs
by randallsquared 3800 days ago
How could adding ignored type annotations cause problems? Any problems that arise would have to be there without the type annotations...?
2 comments

Without the type annotations, you're expected to handle dynamic type checks yourself. With type annotations, you might think that tooling does it for you, so you might omit the dynamic checks. But the tooling doesn't necessarily check all your callers, and you end up with unexpected input.

This is partly what the Typed Racket writers mean when they say that most gradual typing systems like this one are not sound.

http://www.cs.cornell.edu/~fabianm/tpls/papers/20151110.shtm...

http://www.ccs.neu.edu/racket/pubs/popl16-tfgnvf.pdf

It can make debugging harder because "impossible" things happen - when a variable is annotated as a string you may not think to consider the possibility that it's actually an integer. But yes, optional typing is mostly just useless rather than actively harmful.