added questions for optional type and type guard

pull/14/head
pca006132 2021-01-19 15:39:37 +08:00
parent 8d09aea1f7
commit 09234a416b
1 changed files with 5 additions and 0 deletions

View File

@ -126,6 +126,11 @@ class Foo(EnvExperiment):
* Type variable cannot occur alone in the result type, i.e. must be bound to the * Type variable cannot occur alone in the result type, i.e. must be bound to the
input parameters. input parameters.
Questions:
* Should we support things like optional type? (like the one in rust)
* Would it be better to assert on the type variable directly instead of
`type(x)` for type guards?
## Dynamic Dispatch ## Dynamic Dispatch
Type annotations are invariant, so subtype (derived types) cannot be used Type annotations are invariant, so subtype (derived types) cannot be used
when the base type is expected. Example: when the base type is expected. Example: