Optional values and big typecheck refactor #118
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Where do I even begin...
The initial goal was to implement optional values. I've done this by adding an
Optional[T]
enum. But that introduced the issue that we didn't support type parameters yet! So that had to be done first. And that spiraled out of control.So here's a summary of functional changes:
T?
,Foo[A, B, C]
,!
and record types in any place that needs a type expression, instead of only supporting paths.Optional
andVerdict
have this, but the mechanism is generalized.T?
which is identical toOptional[T]
, which is just an enum with two variants. There's no automatic conversion fromT
toT?
and no special operators (yet). But you can construct them and match on them. They can also safely be passed to and from Rust. (Resolves part of Optional values #117)Verdict
needs to be an enum we can match on #103).pointer_bytes
in many places.return
of reference types didn't work infunction
s. That's fixed now.Option
intoOptional
(which has a fixed layout) and back. This might be important for other types later too.Internally some things are cleaner now:
type
declarations.