Stéphane Ducasse wrote:
>
> thanks eliot
>
> this is strange I thought that we fixed that already .... I have to check.
>
> On Dec 18, 2009, at 6:28 PM, Eliot Miranda wrote:
>
>> 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
>> <[email protected]> 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...
>
>
I think the fixed bug was the similar 'Issue 1044: MethodContext
allInstances loops forever'. Not quite the same:
'From Pharo1.0beta of 16 May 2008 [Latest update: #10470] on 17 October 2009
at 4:49:35 pm'!
!Behavior methodsFor: 'accessing instances and variables' stamp:
'MarcusDenker 10/17/2009 16:49'!
allInstances
"Answer a collection of all current instances of the receiver."
| all inst next |
all := OrderedCollection new.
inst := self someInstance.
[inst == nil]
whileFalse: [
next := inst nextInstance.
inst == all ifFalse: [all add: inst].
inst := next].
^ all asArray! !
--
View this message in context:
http://n2.nabble.com/Issue-1633-Object-allSubInstances-appears-to-loop-forever-tp4187269p4188409.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project