Closed seanlnge closed 3 years ago
Hmm, don't you think it's still better to have an error in the errortype enum, like:
enum ErrorType {
...,
RunTime(...)
}
so that way we can use the ?
operator for things like if statements, and we can do error matching in where it actually matters, like in while loops and functions.
What do you mean? The runtime errortype is in the ErrorType enum.
I needed to make a Return
enum to store break
and continue
statements, which required a match expression to check if a Type
was provided, so I just decided to put errors in the else-case of that match
No, your IResult
I mean, it has a return
enum when it technically doesn't -- those errors can be handled by rust automatically through the ?
operator.
Because they are still errors, they will get returned, and so then it's parent function will handle it. Therefore, while loops and functions would only need the match, while variables can just let it pass. Finally, if it reaches the init
stage, all that has to be done would be to print it!
Added errors for break and continue statements, as well as creating a
Return
enum to storeType
,Break
,Continue
, andErr
.