Symbols to Class Names?
bparsia at email.unc.edu
Mon Mar 12 18:22:51 UTC 2001
On Mon, 12 Mar 2001, Dan Shafer wrote:
> Thanks, Randal. But I think I didn't state my question clearly enough.
> I have done a select: to retrieve from Smalltalk all of the classes in the
> image. They are returned to me, however, as an IdentitySet (not an
> IdentityDictionary as I incorrectly stated in my message) containing Symbols
> rather than class names.
Dan, I'm still confused as to what you're doing and what you're *wanting*
to be doing.
Why uses a #select: when SystemDictionary>>classNames will give you the
list of symbols that are the class names?
For that matter, why uses #className when SystemDictionary>>allClasses
gives you a collection with the classes themselves? (Not to
(Note that there are behavior focused selectors too. And one could do some
funky stuff with subclass releated selectors in Behavior, Class, etc.)
> What I want to do now is to enumerate over this
> returned IdentitySet and, for each element it contains, obtain certain
> information about the class to which the Symbol corresponds. Symbols don't
> understand the messages sent to a PseudoClass object, so I can't extract useful
> information about the class from my efforts so far.
select: [:class | class allSubclasses isEmpty not].
returns all the classes with subclasses.
Smalltalk allClasses select: [:class | class hasMethods].
returns all the classes with methods. etc.
Of course, if you want to start with a list of symbols and *then* get the
classes, you could try:
symbolList collect: [:sym | Smalltalk at: sym].
Hope this helps.
More information about the Squeak-dev