4 ms·
> Where are Python, Bash, etc.? [...] While there exist extensions to some dynamic languages imbuing them with static type checking these are not part of the la
by pansa2 6y ago
> Where are Python, Bash, etc.? [...] While there exist extensions to some dynamic languages imbuing them with static type checking these are not part of the language, and the complexity depends not on the language but the extension.
But TypeScript is included. Isn’t it an extension to JavaScript in the same way that Mypy is an extension to Python?
Is there a technical difference that justifies one being included and the other not, or is it just a case of popularity?
- muglug 6y agoI think it’s an important difference: TypeScript is a language that has a typechecker bundled with it. The language and the typechecker are clearly connected, and TypeScript users are very very strongly encouraged to use the typechecker on all typescript code. Type checking is also implicitly described as a language feature. Python has no bundled typechecker, and its authors do not insist users use MyPy, Pyre or any other SA tool.
- nwatson 6y agoType annotations in recent 3.x releases though have made Python a much better language, and in practice the Jetbrains- (Pycharm-)-bundled type-checkers work very well. I'm much more comfortable recently working with larger codebases in Python and don't miss the C++/Java type constraints now.
- pansa2 6y agoSo TypeScript is a separate language from JavaScript, but Mypy is just an extension to Python. Isn’t that merely a difference in marketing?
- bastawhiz 6y agoPython has type annotations but no type checking. The type checker you use for Python may have different soundness/decidability versus other type checkers. There's only one (official) TypeScript type checker, which works in only one way, and introduces both type annotations as well as syntax which compiles to JavaScript that's executed at runtime (enums, decorators).
- Zababa 6y agoIt's not a difference in marketing. Types anotations are part of Python, but not of JavaScript. CPython will happily run a program with type anotations, V8 will fail to parse Typescript. You could draw similarities with using Typescript to check JSDoc comments and MyPy to check Python 2.7 comments, but that's again because type hints are neither part of Python 2.7, nor JavaScript.