2009/7/17 Schwab,Wilhelm K <bschwab@anest.ufl.edu>:
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.
yeah.. implicit temps - this is what i disabling at first place when using workspaces. IMO, it is very error prone feature.
Welcome to Smalltalk, and to the list. Â Enjoy!
Bill
-----Original Message----- From: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of John Escobedo Sent: Thursday, July 16, 2009 7:22 PM To: pharo-project@lists.gforge.inria.fr 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.