Closed Naddiseo closed 9 years ago
How much semantic specification do we actually want to make?
What is responsible for the checking?
The KIS approach to this spec would be to copy what mypy and python did: allow an arbitrary, but valid, expression as the hint, then leave it to a library/build tool/linter to do the checking. Of course, if the hinting is kept around afterwards, a la decorators, the engine can also use them if it so chose. Pros:
Cons:
Arbitrary, not meaning "any expression", but a single variable reference, I'm assuming. If that's the case static analysis should work. Flow does this. Although I'm not sure you can catch everything, so having runtime checking may be beneficial.
There are a couple options we can explore.
I'll flesh this thought out tomorrow; I have to get up in 6 hours.
To keep the spec shorter and more to the point, a hands off approach to the actual linting/enforcing should be taken. Basically, we define the syntax, but not how it should be interpreted by the engine, or a linter.
Precedents: Python's type hinting Rational and Goals