This example shows you what code filed out in the VA Smalltalk Base format looks like. Though you can file out any component loaded in your image, this example files out the method addApplicationsToList, which you created in Example: Adding methods to the defined class Chooser.To file out addApplicationsToList, complete the following steps.Begin by checking the setting for the file-out format. To do this, display the expression System genericFormat in a Transcript or Workspace window. (See Example: Evaluating an expression to change a setting.)If the system returns false, then it is set to the VA Smalltalk Base format. If it returns true, then change the setting to false by evaluating the following:To file out the method addApplicationsToList:
1. Open a Class Browser on the class Chooser.
2.
3.
4. In the displayed prompter, rename the file to add.mth in the entry field where you specify a file name. Then select OK (or Save). The system writes add.mth to the directory where your development image resides.Now, look at add.mth in a Workspace:
1. Select Open from the File menu of any browser. Because you just filed out add.mth, the displayed prompter names it in the file list.
2. The first line of text, ! Chooser privateMethods !, indicates that this is a private method for the class Chooser. When you file in code, the system executes the text between the two exclamation points. This sends the message privateMethods to Chooser. All classes support privateMethods. It enables the system to receive the next set of text as private methods for that class. If you had filed out code in the generic format, the line of text would have read ! Chooser methods !; thus, it would not have indicated the method's structure.The system interprets the text up to the next exclamation point as a method. Each set of text delimited by an exclamation point is referred to as a chunk. The system continues to read the next set of chunks as methods for the designated class until it finds either the end of the file or an empty chunk. An empty chunk contains only a space character. The empty chunk informs the system that there are no more private methods.
|