Create base class for promises#35
Create base class for promises#35BrknRobot wants to merge 2 commits intoReal-Serious-Games:masterfrom
Conversation
This allows code which can handle any type of promise. Creating IPromiseBase allows IPromise, IPromise<int>, and IPromise<MyFunClass> to all be treated identically, without creating code branches for each. The IPromiseBase interface is implemented explicitly, which avoids creating ambiguous functions. Additionally, the Promise_Base class allows for a decent amount of code reuse between generic and non-generic promises.
|
This looks great - would definitely be a good addition to the library. There are couple of things that would be good to change before we merge it though. Some of the new methods don't have It would also be good to have a couple of extra tests to test chaining different types of promise together, now that that is possible. |
|
Writing tests made me realize I missed some functionality. I'll have to implement a few more things before this is ready. |
|
That's fine. Let us know when this pull request is ready to merge and we'll take another look at it. |
|
What is the status of this @nloewen? This would be a very nice addition, just asking before I implement this myself. What functionality was missing? |
|
It's unlikely I'll get around to completing this. I don't recall what functionality was missing. Most likely some combination of chained promises wasn't supported. If you start adding test cases, I'm sure you'll find it. |
This allows code which can handle any type of promise. Creating IPromiseBase allows IPromise, IPromise<int>, and IPromise<MyFunClass> to all be treated identically, without creating code branches for each. The IPromiseBase interface is implemented explicitly, which avoids creating ambiguous functions.
Additionally, the Promise_Base class allows for a decent amount of code reuse between generic and non-generic promises.