logoalt Hacker News

MangoToupelast Wednesday at 5:58 AM1 replyview on HN

It depends on the semantics the language specifies. Whether or not the annotations are optional is irrelevant.

Either way, you didn't annotate the code so it's kind of pointless to discuss.

Also fwiw python is typed regardless of the annotations; types are not optional in any sense. Unless you're using BCPL or forth or something like that


Replies

dwatttttlast Wednesday at 7:06 AM

> Either way, you didn't annotate the code so it's kind of pointless to discuss.

There are several literals in that code snippet; I could annotate them with their types, and this code would still be exactly as it is. You asked why there are competing type checkers, and the fact that the language is only optionally typed means ambiguity like that example exists, and should be a warning/bug/allowed; choose the type checker that most closely matches the semantics you want to impose.

show 1 reply