Many of the use cases of annotated types are technically type information, just type information that isn’t standardized within the type system.
Sized ints, for example, are refinement types.
I don’t see refinement types as likely to reach standardization soon, but I do wonder if there aren’t better approaches to supporting use cases like this
For example, we could change the execution semantics of type alias statements so that the below would work as expected.
type SizedInt[Low, High] = Annotated[int, Meta(ge=Low, le=High)]
u16 = SizedInt[0, 65_535]
Currently, at runtime, this results in u16 having a value of Annotated[int, Meta(ge=Low, le=High), With Low and High being TypeVars, not the actual values parameterized with, even though as far as the static type system is concerned, u16 isn’t generic, and __parameters__ is an empty tuple reflecting such.
The values SizedInt are parameterized with aren’t stored at all on the second line, even though both statically and the runtime implementation can see that the values passed in must be values. Simply storing them for runtime tools to retrieve, even without changing the existing semantics for execution of the alias would also allow this use.