Newsgroups: comp.lang.smalltalk
Path: utzoo!utgpu!cunews!bnrgate!bqnes74!news
From: CWatts@BNR.CA (Carl Watts)
Subject: RE: How Do I Track Globals In Smalltalk/V?
Message-ID: <1991Jun5.173518.7556@bqnes74.bnr.ca>
Sender: news@bqnes74.bnr.ca
Organization: Bell Northern Research
Date: Wed, 5 Jun 91 17:35:18 GMT

Will Estes asks, "Is there a way that I can get a list of user-allocated globals...?"

Yes of course, all globals are just entries in the global Dictionary called "Smalltalk".

Printing "Smalltalk keys" will give you a list of all global variables.  This list contains all classes by name as well since they are available through globals.

So if you want just the globals that aren't classes then print "(Smalltalk reject: [:each | each isBehavior]) keys".
This will give you just the globals that aren't classes (Classes are Behaviors).

Smalltalk comes with several global variables already defined.  Things like "Transcript" and "Display" and "Smalltalk" itself.

In my Smalltalk-80 2.5 image that last expression prints (Smalltalk OpcodePool SystemOrganization IOConstants SourceFiles Sensor Transcript Processor ScheduledControllers IpcConstants Display TextConstants Undeclared).  All of these are global variables that Smalltalk makes itself.

Hope this helps...
