[squeak-dev] Error in Promises/A+ reject implementation?

Tony Garnock-Jones tonyg at leastfixedpoint.com
Thu Jun 4 14:16:26 UTC 2020


Hi Jakob,

On 4/5/20 12:00 AM, Jakob Reschke wrote:
> I think our Promise behaves wrong, but I would like a second opinion.

I think you're right. And I think we should fix it. I'll draft a repair.

I don't think there are many users of Promise out there -- if there are,
and any are reading this, please speak up if fixing the bug Jakob
reported would be a problem.

> I think the behavior in our Promise is also in violation with the
> Promises/A+ specification it claims to implement
> (https://promisesaplus.com/):
> 
> [...]
> 2.2.7 then must return a promise.
> 
>     promise2 = promise1.then(onFulfilled, onRejected);
> 
> 2.2.7.1 If either onFulfilled or onRejected returns a value x, run the
> Promise Resolution Procedure [[Resolve]](promise2, x).
> 
> 2.2.7.2 If either onFulfilled or onRejected throws an exception e,
> promise2 must be rejected with e as the reason.
> [...]

Thanks for digging into the spec here. That'll be helpful for getting
the tests right.

> On an only slightly related note, I am unhappy that I cannot debug
> errors in promise handler blocks [...] Opinions?

I don't know what to think about this, I'm afraid! I'd be keen to hear
more from others about what a good alternative to the current behaviour
might be.

Regards,
  Tony


More information about the Squeak-dev mailing list