The Inbox: Kernel-tonyg.1150.mcz

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

The Inbox: Kernel-tonyg.1150.mcz

commits-2
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-tonyg.1150.mcz

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

Name: Kernel-tonyg.1150
Author: tonyg
Time: 1 February 2018, 9:59:50.393266 am
UUID: 6afb5455-c040-4572-a62a-b292e20856e6
Ancestors: Kernel-tonyg.1149

(Re)introduce isPromise, and use it instead of isKindOf:.

=============== Diff against Kernel-tonyg.1149 ===============

Item was added:
+ ----- Method: Object>>isPromise (in category 'testing') -----
+ isPromise
+ ^false!

Item was changed:
  ----- Method: Promise>>isPromise (in category 'testing') -----
  isPromise
+ ^ true!
- ^ true.!

Item was changed:
  ----- Method: Promise>>resolveWith: (in category 'resolving') -----
  resolveWith: arg
  "Resolve this promise. If arg is itself a Promise, make this promise depend upon it,
  as detailed in the Promises/A+ spec:
  https://promisesaplus.com/#the-promise-resolution-procedure"
 
+ arg isPromise
- (arg isKindOf: Promise)
  ifTrue: [
  arg whenResolved: [:v | self resolveWith: v].
  arg whenRejected: [:e | self rejectWith: e]]
  ifFalse: [
  mutex critical: [
  (state == #pending) ifTrue: [
  value := arg.
  state := #fulfilled.
  resolvers do: [:r | self evaluateResolver: r]]]]!