Sorting and Inspecting Things

Previous pageNext page

All the classes in the system (well over 1000) in ascending name order."

Class allClasses asSortedCollection.

 


Use Ctrl+D to evaluate and display the above expression. This asks the Class object to give back a collection of all of the classes in the system and then asks for this to be turned into a sorted collection so the results come out in alphabetical order.

If you look closely you'll see that the list isn't complete but is terminated by etc... This is just Dolphin's way  of truncating a long list of things because you're probably not interested in reading through all that detail. If you actually want to see all the results then you can do this using an Inspector. Delete the results you have displayed so far, put the cursor back on the expression line and then type Ctrl+I (Inspect It), This brings up another window which is the Inspector. Using this you can browse around the entire collection of results (don't worry, you can't do any damage). To see the complete list, select a SortedCollection in the left hand pane and scroll down the list in the right.

Close the Inspector when you're done.

Notice the #asSortedCollection message that was sent in the above example? In Smalltalk most messages beginning with #asXXX are used to ask one type of object to convert itself to another. In this case you are asking the OrderedCollection (which is answered by #allClasses) to convert itself to a SortedCollection.

Remember, to get back to these experiments just choose Help/First Splash in any Dolphin tool window.