added questions for optional type and type guard

This commit is contained in:
pca006132 2021-01-19 15:39:37 +08:00
parent 8d09aea1f7
commit 09234a416b

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: