The Trunk: Kernel-tonyg.1330.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-tonyg.1330.mcz

commits-2
Tony Garnock-Jones uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-tonyg.1330.mcz

==================== Summary ====================

Name: Kernel-tonyg.1330
Author: tonyg
Time: 4 June 2020, 4:44:15.894747 pm
UUID: 76ade342-1acf-4780-8cda-610dba22bbec
Ancestors: Kernel-eem.1329

Repair a discrepancy between current Promise implementation and the Promises/A+ spec. (Bug reported by Jakob Reschke on squeak-dev, 5 April 2020)

=============== Diff against Kernel-eem.1329 ===============

Item was changed:
  ----- Method: Promise>>then:ifRejected: (in category 'monad') -----
  then: resolvedBlock ifRejected: errBlock
  "Return a Promise that, if it resolves, runs the resolvedBlock. If resolution throws an Exception, it runs the errBlock."
  | p |
  p := Promise new.
  self whenResolved: [:v |
  [p resolveWith: (resolvedBlock value: v)]
  on: Error do: [:e | p rejectWith: e]].
+ self whenRejected: [:e |
+ [p resolveWith: (errBlock value: e)]
+ on: Error do: [:e2 | p rejectWith: e2]].
- self whenRejected: [:e | p rejectWith: (errBlock value: e)].
  ^ p.!