Greetings,
The main program I am working on now is called Books.
If I evaluate
Books allInstances => anOrderedCollection( aBook aBook aBook )
How do I set them all equal to nil like
Books removeAllInstances.
Books allInstances => anOrderedCollection().
Sincerely,
Joseph.
Caution: lowskilled hobbyist anyway: Hi Joseph, Smalltalk garbageCollect does that automatically for you BUT it removes only objects that are not in connection with other objects. So you have to cut loose all connections from other objects to your Book instances. Maybe you have variables within a workspace pointing to some Book instances. Or a list object with references to all of your books. (How do you get to your books?) Even an inspector, explorer or debugger pointing to a Book instance keeps the garbagecollector from removing them. Hope that helps a little
Rudolf --
Gesendet: Freitag, 23. September 2016 um 07:40 Uhr Von: "Joseph Alotta" joseph.alotta@gmail.com An: beginners@lists.squeakfoundation.org Betreff: [Newbies] remove allInstances? Greetings,
The main program I am working on now is called Books.
If I evaluate
Books allInstances => anOrderedCollection( aBook aBook aBook )
How do I set them all equal to nil like
Books removeAllInstances.
Books allInstances => anOrderedCollection().
Sincerely,
Joseph.
_______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Joseph: I agree with Rudolf. See also http://forum.world.st/Deleting-an-instance-td3328590.html
Have fun! David
Hi Joseph,
Try:
Books allInstances do: [:b | b become: nil].
Lou
On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta joseph.alotta@gmail.com wrote:
Greetings,
The main program I am working on now is called Books.
If I evaluate
Books allInstances => anOrderedCollection( aBook aBook aBook )
How do I set them all equal to nil like
Books removeAllInstances.
Books allInstances => anOrderedCollection().
Sincerely,
Joseph.
Nice. That causes Squeak 5.0 to unexpectedly quit.
But when I start again, there are no instances of Books.
Sincerely,
Joseph
On Sep 23, 2016, at 7:59 AM, Louis LaBrunda [via Smalltalk] ml-node+s1294792n4916784h53@n4.nabble.com wrote:
Books allInstances do: [:b | b become: nil].
-- View this message in context: http://forum.world.st/remove-allInstances-tp4916693p4916813.html Sent from the Squeak - Beginners mailing list archive at Nabble.com.
Woop woop, alarm alarm, error error.
Sorry my alarm just went off. If Squeak quit after a become and you are seeing differences after not saving things, something is wrong.
Be afraid, be very afraid.
All the best,
Ron Teitelbaum
From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of Joseph Alotta Sent: Friday, September 23, 2016 10:15 AM To: beginners@lists.squeakfoundation.org Subject: [Newbies] Re: remove allInstances?
Nice. That causes Squeak 5.0 to unexpectedly quit.
But when I start again, there are no instances of Books.
Sincerely,
Joseph
On Sep 23, 2016, at 7:59 AM, Louis LaBrunda [via Smalltalk] <[hidden
email]> wrote:
Books allInstances do: [:b | b become: nil].
_____
View this message in context: Re: remove allInstances? http://forum.world.st/remove-allInstances-tp4916693p4916813.html Sent from the Squeak - Beginners mailing list archive http://forum.world.st/Squeak-Beginners-f107673.html at Nabble.com.
maybe they were garbage collected before the crash or on startup.
On Sep 23, 2016, at 9:23 AM, Ron Teitelbaum [via Smalltalk] ml-node+s1294792n4916819h38@n4.nabble.com wrote:
Woop woop, alarm alarm, error error.
Sorry my alarm just went off. If Squeak quit after a become and you are seeing differences after not saving things, something is wrong.
Be afraid, be very afraid.
All the best,
Ron Teitelbaum
From: [hidden email] [mailto:[hidden email]] On Behalf Of Joseph Alotta Sent: Friday, September 23, 2016 10:15 AM To: [hidden email] Subject: [Newbies] Re: remove allInstances?
Nice. That causes Squeak 5.0 to unexpectedly quit.
But when I start again, there are no instances of Books.
Sincerely,
Joseph
On Sep 23, 2016, at 7:59 AM, Louis LaBrunda [via Smalltalk] <[hidden email]> wrote:
Books allInstances do: [:b | b become: nil].
View this message in context: Re: remove allInstances? Sent from the Squeak - Beginners mailing list archive at Nabble.com.
Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners
If you reply to this email, your message will be added to the discussion below: http://forum.world.st/remove-allInstances-tp4916693p4916819.html To start a new topic under Squeak - Beginners, email ml-node+s1294792n107673h12@n4.nabble.com To unsubscribe from Squeak - Beginners, click here. NAML
-- View this message in context: http://forum.world.st/remove-allInstances-tp4916693p4916832.html Sent from the Squeak - Beginners mailing list archive at Nabble.com.
Hi,
On 23.09.2016, at 15:03, Louis LaBrunda Lou@Keystone-Software.com wrote:
Hi Joseph,
Try:
Books allInstances do: [:b | b become: nil].
I would advise against that. Become is a sledgehammer and you're about to crush ants with it.
What happens with 'a become: b' ? All occurrences of 'a' in the image are replaced by 'b' and (this is important) vice versa. So, all 'b's are replaces by 'a'.
With your example, all occurrences of nil are replaced with an instance of Book, in the whole image. This is most probably _not_ what you want.
These two versions work better:
Books allInstances do: [:b | b becomeForward: nil]. Books allInstances do: [:b | b become: Object new].
The first avoids the 'vice versa' part of become: and is more safe, the second one does the switcharoo with a new object every time, wich is also more safe.
Anyhow, I presume that your intent is to track down instances of Book wich you don't know where they are.
Maybe they are actually unreferenced already, so Smalltalk garbageCollect can get already rid of them.
If that does not help, you can try to track the references down by doing
Books allInstances do: [:b | b chasePointers]
which will open a PointerFinder for each of the rouge object so you can inspect where they get referenced.
I hope this helps.
Best regards -Tobias
Lou
On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta joseph.alotta@gmail.com wrote:
Greetings,
The main program I am working on now is called Books.
If I evaluate
Books allInstances => anOrderedCollection( aBook aBook aBook )
How do I set them all equal to nil like
Books removeAllInstances.
Books allInstances => anOrderedCollection().
Sincerely,
Joseph.
-- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Hi,
Tobias is right. I'm use to the VA Smalltalk one way #become: and forgot about Squeaks two way #become:, sorry about that.
Lou
On Fri, 23 Sep 2016 19:47:31 +0200, Tobias Pape Das.Linux@gmx.de wrote:
Hi,
On 23.09.2016, at 15:03, Louis LaBrunda Lou@Keystone-Software.com wrote:
Hi Joseph,
Try:
Books allInstances do: [:b | b become: nil].
I would advise against that. Become is a sledgehammer and you're about to crush ants with it.
What happens with 'a become: b' ? All occurrences of 'a' in the image are replaced by 'b' and (this is important) vice versa. So, all 'b's are replaces by 'a'.
With your example, all occurrences of nil are replaced with an instance of Book, in the whole image. This is most probably _not_ what you want.
These two versions work better:
Books allInstances do: [:b | b becomeForward: nil]. Books allInstances do: [:b | b become: Object new].
The first avoids the 'vice versa' part of become: and is more safe, the second one does the switcharoo with a new object every time, wich is also more safe.
Anyhow, I presume that your intent is to track down instances of Book wich you don't know where they are.
Maybe they are actually unreferenced already, so Smalltalk garbageCollect can get already rid of them.
If that does not help, you can try to track the references down by doing
Books allInstances do: [:b | b chasePointers]
which will open a PointerFinder for each of the rouge object so you can inspect where they get referenced.
I hope this helps.
Best regards -Tobias
Lou
On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta joseph.alotta@gmail.com wrote:
Greetings,
The main program I am working on now is called Books.
If I evaluate
Books allInstances => anOrderedCollection( aBook aBook aBook )
How do I set them all equal to nil like
Books removeAllInstances.
Books allInstances => anOrderedCollection().
Sincerely,
Joseph.
-- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
beginners@lists.squeakfoundation.org