The Inbox: Kernel-ct.1295.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-ct.1295.mcz

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

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

Name: Kernel-ct.1295
Author: ct
Time: 24 January 2020, 5:20:51.814415 pm
UUID: 18ea3b5d-ee42-2944-9d01-aa48e43207a7
Ancestors: Kernel-nice.1292

Extends BlockClosure >> #whileNil: by returning the final non-nil value. Adds #whileNil analogous to #whileTrue and #whileFalse.

        [Project uiManager chooseFrom: #(foo bar) values: #(Foo Bar)] whileNil.

        [Project uiManager chooseFrom: #(foo bar) values: #(Foo Bar)] whileNil: [self inform: 'You have to decide!']

=============== Diff against Kernel-nice.1292 ===============

Item was added:
+ ----- Method: BlockClosure>>whileNil (in category 'controlling') -----
+ whileNil
+ "Unlike #whileTrue/False this is not compiled inline."
+ | result |
+ [(result := self value) isNil] whileTrue.
+ ^ result
+ !

Item was changed:
  ----- Method: BlockClosure>>whileNil: (in category 'controlling') -----
  whileNil: aBlock
  "Unlike #whileTrue/False: this is not compiled inline."
+ | result |
+ [(result := self value) isNil] whileTrue: [aBlock value].
+ ^ result
- ^ [self value isNil] whileTrue: [aBlock value]
  !