-
-
Notifications
You must be signed in to change notification settings - Fork 73
AsyncRequest return type should be known at compile time #62
Comments
Here are a few concerns: How would that work when using listeners to wait for the result? Example:
Sure, you could make Another thought, what's with the design pattern to have one listener listen to every asynchronous request via Also changing the
|
Yes, This would imply to change
I dont think so.
This is because type safty is not built in the other functions. If you start being typesafe from lowlevel on, they will disappear:
I know its a big change and would require a lot of code being changed but I think its worth it. The global listener is a problem though. I have to think about how this could be solved. hm.. |
I recently had the idea to move towards a Future design pattern for asynchronous requests. This comment is mostly a reminder to myself to get back to it one day, but if anyone got any thoughts on this, please feel free to discuss and share your thoughts. |
The current implementation of
AsyncRequest#getDto()
takes a generic parameter to specify the return type of the method. This makes it impossible to see whatasyncRequest.getDto()
is actually returning. It could be a summoner, a CurrentGameInfo or anything else. We only know it from looking at the context, but not from the object itself.Additionally it can lead to runtime exceptions like this:
I wonder what led to this design decision. Wouldnt it be more convenient to have a fixed return type with an implementation like this?
Best Regards,
Daniel
The text was updated successfully, but these errors were encountered: