[squeak-dev] The Inbox: System-cwp.662.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Jan 12 15:24:42 UTC 2014
A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-cwp.662.mcz
==================== Summary ====================
Name: System-cwp.662
Author: cwp
Time: 12 January 2014, 10:23:54.166 am
UUID: 38c55d98-af64-4c5e-abbf-df86ad07fc7b
Ancestors: System-cwp.661
Remove the marker object from allObjectsDo:, and return to iterating until 0 is encountered. Also, fetch the next object before evaluating the block, to allow the block to use #become: safely.
=============== Diff against System-cwp.661 ===============
Item was changed:
----- Method: SystemNavigation>>allObjectsDo: (in category 'query') -----
allObjectsDo: aBlock
"Evaluate the argument, aBlock, for each object in the system
+ excluding SmallIntegers. New objects created by aBlock will
+ be included in the enumeration, and it is up to the caller to avoid
+ creating new objects faster than they are enumerated. It's
+ important that the next object is fetched before the block is
+ evaluated, because the block may use #become: to change the
+ identity of object."
+
+ | object nextObject |
- excluding SmallIntegers. With closures, this needs to use an end
- marker (lastObject) since activation of the block will create new
- contexts and cause an infinite loop."
- | object lastObject |
object := self someObject.
+ [nextObject := object nextObject.
+ aBlock value: object.
+ object := nextObject.
+ 0 == nextObject]
+ whileFalse.
+ !
- lastObject := Object new.
- [lastObject == object or: [0 == object]]
- whileFalse: [aBlock value: object.
- object := object nextObject]!
More information about the Squeak-dev
mailing list
|