John, As Sig already said, globals should be used sparingly. You should read about workspace variables. Personally, I can't stand them, but others like them and you might too. You can also define temporaries in a workspace, something like
| mySquare | mySquare := Morph new. ... The problem (or feature, depending on your perspective) is that mySquare will go away as soon as the expressions are evaluated, unless you inspect it or otherwise take steps to keep it around. Workspace variables will stick around, which is why they end up irritating me. I also do not like the implicit definition of them; it's easy to slip spelling, and instead of getting a syntax error, you get broken code, which is the _real_ reason I do not like them. Welcome to Smalltalk, and to the list. Enjoy! Bill -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of John Escobedo Sent: Thursday, July 16, 2009 7:22 PM To: [email protected] Subject: [Pharo-project] Where declared global reside... how can they be removed? Hi everyone, I'm new to both Smalltalk and especially to Pharo (and this mailing list). I have a very basic question and would like to be directed to more info or a different mailing list if appropriate. For most tutorials (I'm using squeak tutorials), one does a lot of work in a workspace. If I make a new global variable such as: MySquare := Morph new ...once I define "MySquare" as a global variable I know I can send it many messages like: MySquare openInWorld MySquare color: Color yellow When I'm done and I close the workspace, save the image and save the image. When I open it again it will know what "MySquare" is known in any workspace. How do I remove "MySquare" and/or the associated object? How could I see or find other such global variables? - John _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
