29 Jun 2022 29 Jun '22
Am 29.06.22 um 00:53 schrieb Eric Traut:
- Sebastian suggested that there might be better alternatives to the colon token for specifying an upper bound or constraints. Potential replacements include "<" or "<:". (Note: I think I still prefer colon here, but that might be because of familiarity.)
While most other punctuation is familiar from other parts of Python, colons are only used as block start and for type annotations so far. My suggestion was to use "T(int)" to signal a sub-type relationship, similar to how sub-class relationships are declared, but that might not be obvious either. As Python is usually a fairly verbose, keyword-based language, maybe it could also make sense to use a keyword for this.
Regarding extensibility: Apart from defaults (which we will need in a foreseeable future), what features do other languages have for type variables that we don't yet? Is it even likely that we will extend type variables in the future?