with closures the block in allSubInstances will be a different object on each evaluation. �Pre closures this would have been a single BlockContext used for each evaluation of the block (and hence non-reentrant). �So you need to modify, e.g. by implementing allInstancesDo: in MethodContext class:

'From Croquet1.0beta of 11 April 2006 [latest update: #1] on 18 December 2009 at 9:26:47 am'!

!MethodContext class methodsFor: 'hacks' stamp: 'ar 9/17/2008 16:24'!
allInstancesDo: aBlock
"Only count until thisContext"
| inst next |
inst := self someInstance.
[inst == thisContext] whileFalse:[
next := inst nextInstance.
aBlock value: inst.
inst := next]! !

find it attached

On Fri, Dec 18, 2009 at 7:47 AM, Stan Shepherd <stan.shepherd414@gmail.com> wrote:

Pharo image: Pharo | Pharo-core
PharoCore1.0rc1 Latest update: #10502
VM: unix - i686 - linux-gnu - Pharo0.1 of 16 May 2008 [latest update:
#10074]

Steps to reproduce:
1.Object allSubInstances

It appears to be repeatedly adding its current context.

...Stan

OrderedCollection>>addLast:
� � � �Receiver: an OrderedCollection(an Object an Object an Object an
Object an Object an Object an Object...etc...
� � � �Arguments and temporary variables:
� � � � � � � �newObject: � � �[] in Object
class(Behavior)>>allSubInstances
� � � �Receiver's instance variables:
� � � � � � � �array: �an Array(an Object an Object an Object an Object an
Object an Object an ...etc...
� � � � � � � �firstIndex: � � 1
� � � � � � � �lastIndex: � � �1173805

OrderedCollection>>add:
� � � �Receiver: an OrderedCollection(an Object an Object an Object an
Object an Object an Object an Object...etc...
� � � �Arguments and temporary variables:
� � � � � � � �newObject: � � �[] in Object
class(Behavior)>>allSubInstances
� � � �Receiver's instance variables:
� � � � � � � �array: �an Array(an Object an Object an Object an Object an
Object an Object an ...etc...
� � � � � � � �firstIndex: � � 1
� � � � � � � �lastIndex: � � �1173805

[] in Object class(Behavior)>>allSubInstances
� � � �Receiver: Object
� � � �Arguments and temporary variables:
� � � � � � � �aCollection: � �[] in Object
class(Behavior)>>allSubInstances
� � � � � � � �x: � � �an OrderedCollection(an Object an Object an Object
an Object an Object an Ob...etc...
� � � �Receiver's instance variables:
� � � � � � � �superclass: � � ProtoObject
� � � � � � � �methodDict: � � a MethodDictionary(size 408)
� � � � � � � �format: � � � � 2
� � � � � � � �instanceVariables: � � �nil
� � � � � � � �organization: � ('*DynamicBindings' binding binding:
hasBinding removeBinding)
('...etc...
� � � � � � � �subclasses: � � {BalloonState. StandardFileMenuResult.
UndefinedObject. Boolean. Fi...etc...
� � � � � � � �name: � #Object
� � � � � � � �classPool: � � �a Dictionary(#DependentsFields->a
WeakIdentityKeyDictionary(MCWorkin...etc...
� � � � � � � �sharedPools: � �nil
� � � � � � � �environment: � �Smalltalk
� � � � � � � �category: � � � #'Kernel-Objects'
� � � � � � � �traitComposition: � � � {}
� � � � � � � �localSelectors: � � � � nil
...
--
View this message in context: http://n2.nabble.com/Issue-1633-Object-allSubInstances-appears-to-loop-forever-tp4187269p4187269.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project