David Hamilton
12/18/2023, 7:58 PMeither
?
Also, has this internal approach changed for Arrow 1.2 (as well as the obvious change for Raise<E>
)?Riccardo Cardin
12/18/2023, 8:42 PMRiccardo Cardin
12/18/2023, 8:42 PMYoussef Shoaib [MOD]
12/18/2023, 10:43 PMraise()
, a RaiseCancellationException
(usually the NoTrace
version of it because it's more efficient) is thrown, and inside it contains your Raise
instance, and the value you raised. Then, every fold
block (which all raise builders ultimately call) will end up identity-checking that RaiseCancellationException.raise === expectedRaiseInstance
. If that's true, then it casts the value to the expected type, and it's passed to the recover: (Error) -> R
lambda that fold
accepts.
It all boils down to myRaise.raise(errorVal) == throw RaiseCancellationException(myRaise, errorVal)
and fold == try { block(myRaise) } catch(e: CancellationException) { recover(e.raisedOrRethrow(myRaise)) }
where e.raisedOrRethrow(myRaise) == if(e is RCE && e.raise == myRaise) e.value else throw e
Youssef Shoaib [MOD]
12/18/2023, 10:46 PMCancellationException
, which RCE inherits fromDavid Hamilton
12/18/2023, 11:00 PMDavid Hamilton
12/18/2023, 11:05 PMRiccardo Cardin
12/19/2023, 6:06 AM