You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So running the future works neither in the main thread, nor inside an
actor. This is because Responder.run calls respond on the future,
which never returns for Futures:
Obviously, run needs to do different things for different kinds
of Responders. But actually, Future provides the same functionality
with apply() that Responder.run() does for "normal" Responders.
An elegant solution would be to simply add an apply() method
to Responder, too, and have Responder.run just call apply on
the responder in question:
Calling Responder.run on Futures does not work.
Running this
in the REPL yields
So running the future works neither in the main thread, nor inside an
actor. This is because Responder.run calls respond on the future,
which never returns for Futures:
An ugly workaround would be to define
using apply() in case of futures. Then this works:
Proposed solution:
Obviously, run needs to do different things for different kinds
of Responders. But actually, Future provides the same functionality
with apply() that Responder.run() does for "normal" Responders.
An elegant solution would be to simply add an apply() method
to Responder, too, and have Responder.run just call apply on
the responder in question:
I'm not sure if the Option stuff in apply is strictly necessary, I just tried to preserve the current implementation of run as much as possible.
This would require very litte code changes. It also shouldn't break anything, should it?
The text was updated successfully, but these errors were encountered: