home *** CD-ROM | disk | FTP | other *** search
- Some notes on VisualWorks Smalltalk:
-
- 1) Interactive testing and debugging output can be conveniently displayed
- in the system transcript display of the VW Launcher window by sending
- appropriate messages to global variable Transcript. The standard way
- to do this is illustrated by
-
- Transcript show: aString; cr
-
- which causes the String aString to be displayed in the transcript, followed
- by a carriage return.
-
-
- 2) printOn: is used by the print: method for Transcript, but the results
- are not quite what would be expected. If X is an instance of a class for
- which printOn: has been provided, then the value of X as defined by the
- printOn: method can be displayed on Transcript by
-
- Transcript print: X; endEntry.
-
- but as indicated above, the format is not quite what is normally desired.
-
-
- 3) The method printString is predefined for many predefined nonString
- classes. It returns a string representation of its receiver that is
- appropriate for printing. (Note that the reason for the name "printString"
- is that it returns a string for printing, not that it prints a string.)
- Thus, for example,
-
- Transcript show: (17 printString); cr.
-
- causes "17" (without quotes) to be printed on the transcript. To be
- consistent with the predefined methods, it is often a good idea to
- define a printString method for user-defined classes.
-
-
- 4) The withCRs method for instances of String returns the string obtained
- by replacing each of the backslash characters (\) of the target string
- (receiver of the withCRs message) by a carriage-return character. For
- example, if s is a string, then the value of
-
- s withCRs
-
- is the value of s with all '\' characters replaced by a CR character.
- In building a string for a printString method, it is convenient to
- initially use backslash characters where a CR is desired, and then use
- withCRs to convert all the backslash characters to CRs as the last step.
-
-
-
- Some differences between VW Smalltalk and GNU Smalltalk:
-
- (Each of the following applies to VW Smalltalk.)
-
- 1) The nl method in GNU Smalltalk is cr in VisualWorks.
-
- 2) A string parameter (not nil) is required for the category: component
- of a class definition.
-
- 3) Global variable names must begin with an upper-case letter.
-
- 4) There is no printNl.
-
- 5) !! is considered to be a single symbol. (Use ! ! instead.)
-