[squeak-dev] Promise resolve
David T. Lewis
lewis at mail.msen.com
Sat Dec 15 02:30:28 UTC 2018
It sounds like a reasonable convenience method.
I am curious though - in what case is there an instance of Promise
that should not be resolved with an actual value? By definition, a
Promise represents the result of a (future) method evaluation. I would
expect that in normal use, the value of the Promise would be nil if
and only if the future evaluation answers nil.
But maybe we have instances of Promise that cannot or will not be
evaluated normally, and we just need to clean them up?
On Fri, Dec 14, 2018 at 10:15:34AM +0100, Marcel Taeumel wrote:
> Sounds good. There are many classes in Squeak with similar convenience messages.??
> Am 14.12.2018 10:12:10 schrieb patrick.rein at hpi.uni-potsdam.de <patrick.rein at hpi.uni-potsdam.de>:
> Hi everyone,
> during a project some students recently used Promise objects a lot. Due to the nature of the project, they often wanted to resolve a Promise without a value. As there is no #resolve method they resorted to `resolveWith: nil`. As this is rather ugly, I would like to propose an additional (convenience) method #resolve which simply resolves the Promise with the value nil. This would also mirror the #then: protocol as the resolve block does not have to accept the argument passed by the promise.
> A downside of this proposal is that the protocol of Promise is currently quite lean and the method does not add anything substantial.
More information about the Squeak-dev