Replies: 1 comment
-
I totally support adding settings to the awaitable structure to configure what you're waiting for. It's an elegant and powerful pattern. To prevent breaking change, you can still throw an exception if nothing is configured, since it makes no sense if you don't know what you're waiting for. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, when we await a
Feed<T>
inNone
state, the return value isdefault(T?)
(i.e.await State.Empty<int>(this) == null
).In order to avoid confusion between
None
andSome(null)
we added a type constraintT : notnull
. This means that you cannot await aFeed<int?>
which might be confusing. To await aFeed<T?>
you need to doawait Feed<T?>.Option()
.A solution could be to change the behavior (breaking change at runtime) to instead throw an exception if
None
. We would then be able to remove the type constraint on theGetAwaiter
.As usually when we await a
Feed<T>
(imperative code) we expect it to not be none, it could be simpler. And if user expects the feed to be none, he would thenawait Feed<T>.Option()
to support it.await Feed<T?>.Option()
await Feed<T?>
None
(no matter type of T)await Feed<T>
await Feed<T>.Option()
Note:
Awaiter also have support for the 2 others "main axes"
Beta Was this translation helpful? Give feedback.
All reactions