25 Oct
2021
25 Oct
'21
4:52 a.m.
I like it! I remember seeing the hypothetical `<:` operator used for describing subclass relations in the Python documentation and other languages, and `<=` looks pretty similar. But since `a <= b` it often implies `a < b or a == b`, you'd also expect `<` and `==` to be valid here. It also raises the question of whether `*xs: SupportsAbs[float] >= T` is valid, since that `>=` could also imply a lower type bound, which is a thing in e.g. Scala. So what about making it look like the subclass constructor syntax instead: `*xs: T(SupportsAbs[float])` ? For value restrictions, the `in` operator can be problematic at runtime, since it always returns a boolean. So perhaps something like `x: T(str) | T(bytes)` could be used for this instead?