than_
01/05/2021, 10:12 AMEither::catch
is no longer suspend function and I'm curious what is the reasoning behind that change? I thought the reason was to denote it as a side effect, since throwing is a side effect. That I presume didn't change 😄simon.vergauwen
01/05/2021, 10:28 AMsuspend
.
There are a couple of reasons or argumentations for removing suspend
and just keeping it inline
.
We can consider pure inline
functions co-pure since they can be used from pure contexts, but also from side-effecting ones.
Since inline
allows suspension to pass through, it can safely call suspension side-effects inside it's inlined body.
Since Either.catch
in its definition itself is pure
there is no strong reason to keep it suspend
, and by lifting that restriction we also ease the interopt with Java libraries for example.
Performance-wise it's also beneficial to have it non-suspend inline
over, suspend with a suspend
lambda.than_
01/05/2021, 10:50 AM