Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.812.mcz==================== Summary ====================
Name: Collections-mt.812
Author: mt
Time: 18 December 2018, 11:58:09.289023 am
UUID: 64ff5a45-61b5-5642-aa46-9fbeac0215dd
Ancestors: Collections-eem.811
Adds a small scripting/debugging interface to evaluate code on a heterogeneous collection. Ignore errors on the way.
1. Example: A bunch of morphs whose n-th submorph should be made yellow. Would raise errors for morphs with less than n submorphs.
ActiveWorld submorphs try: [:ea | ea submorphs fifth color: Color yellow].
2. Example: Fetch the selected classes of all code browsers through the submorph interface.
| results |
results := OrderedCollection new.
ActiveWorld submorphs try: [:ea | results add: ea model selectedClass].
results explore.
=============== Diff against Collections-eem.811 ===============
Item was added:
+ ----- Method: Collection>>try: (in category 'enumerating') -----
+ try: aBlock
+ "Evaluate aBlock with each of the receiver's elements as the argument. On error, skip that element and continue."
+
+ ^ self try: aBlock ignore: Error!
Item was added:
+ ----- Method: Collection>>try:ignore: (in category 'enumerating') -----
+ try: aBlock ignore: exceptionOrExceptionSet
+ "Evaluate aBlock with each of the receiver's elements as the argument. On error, skip that element and continue."
+
+ ^ self
+ try: aBlock
+ ignore: exceptionOrExceptionSet
+ logged: false!
Item was added:
+ ----- Method: Collection>>try:ignore:logged: (in category 'enumerating') -----
+ try: aBlock ignore: exceptionOrExceptionSet logged: aBoolean
+ "Evaluate aBlock with each of the receiver's elements as the argument. On error, skip that element and continue."
+
+ ^ self do: [:ea |
+ [aBlock value: ea]
+ on: exceptionOrExceptionSet
+ do: [:err | aBoolean ifTrue: [Transcript showln: err messageText]]]!