Symbols to Class Names?

Dan Shafer dshafer at yahoo.com
Mon Mar 12 18:30:50 UTC 2001


Thanks, guys. I didn't dig deeply enough into the Smalltalk dictionary stuff
before beginning. Instead, I took a bit of sample code from the class comment
in SystemDictionary as a beginning point and tried to modify that code to do
what I was trying to do.

I will now go off and study SystemDictionary in greater depth and probably save
myself another ton of work.

Thanks for the pointers, Bijan and Randal, and for the quick responses!

--- Bijan Parsia <bparsia at email.unc.edu> wrote:
> 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
> mention #allClassesDo:)
> 
> (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.
> 
> So:
> 	Smalltalk allClasses 
> 		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.
> 
> Cheers,
> Bijan Parsia.
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/





More information about the Squeak-dev mailing list