Symbols to Class Names?

Randal L. Schwartz merlyn at stonehenge.com
Mon Mar 12 09:16:48 UTC 2001


>>>>> "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!





More information about the Squeak-dev mailing list