Replies: 1 comment
-
That's a bit difficult. var f Future[int] // = get it from somewhere.
f.Get() // <- this will block
f.Get() // <- this will not
Other languages like C++ have tried to address this by having both an explicit For now I'm not planning to change the interface. |
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
-
The
Future
interface has only one behavior, which is to return a value if it's been set, and to block otherwise:Calls to execute activities (
workflow.ExecuteActivity
), schedule timers (workflow.ScheduleTimer
), and create subworkflowsworkflow.CreateSubWorkflowInstance
(among others) returnFuture
s which users often block on in order to obtain a usable value, or handle errors if they occur.While
Get(ctx)
works to illustrate what action theFuture[T]
is performing, a semantics which makes it more clear what action library users perform before aFuture[T]
returns could be more intuitive. With this in mind, I'm curious ifWait(ctx)
might be a fitting, usability-enhancing alternative toGet(ctx)
?i.e.
Beta Was this translation helpful? Give feedback.
All reactions