Symbols to Class Names?

Dan Shafer dshafer at yahoo.com
Mon Mar 12 17:56:13 UTC 2001


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. 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.

I've tried the MethodFinder but it tells me that converting a symbol to what I
give it as a class name can't be done in one method.

--- "Randal L. Schwartz" <merlyn at stonehenge.com> wrote:
> >>>>> "Dan" == Dan Shafer <dshafer at yahoo.com> writes:
> 
> Dan> Given an IdentityDictionary of symbols, each of which is known to
> Dan> represent a valid Smalltalk class name, what method will convert
> Dan> the symbols to class names so I can enumerate them?
> 
> Smalltalk at: #SmallInteger => SmallInteger (class)
> 
> for verification, you can ensure the "result isKindOf: Class" to make
> sure you didn't just pick up a global instead.  So, in your case:
> 
> classList _
>   (yourDictionary collect: [:i | Smalltalk at: i ifAbsent: nil])
>      select: [:i | i isKindOf: Class]
> 
> If the parens offend anyone, let me know.  I still program Lisp in
> every language I write. :)
> 
> -- 
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
> 


__________________________________________________
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