home *** CD-ROM | disk | FTP | other *** search
/ European Smalltalk User Group 2004 September / esugcd.iso / Books-Tutorial-Lectures / Tutorials / vw-tutorials / AnApplikationAproach / notes.txt < prev    next >
Text File  |  1995-09-27  |  2KB  |  65 lines

  1. Some notes on VisualWorks Smalltalk:
  2.  
  3. 1) Interactive testing and debugging output can be conveniently displayed
  4. in the system transcript display of the VW Launcher window by sending
  5. appropriate messages to global variable Transcript.  The standard way
  6. to do this is illustrated by
  7.  
  8.    Transcript show: aString; cr
  9.  
  10. which causes the String aString to be displayed in the transcript, followed
  11. by a carriage return.
  12.  
  13.  
  14. 2) printOn: is used by the print: method for Transcript,  but the results
  15. are not quite what would be expected.  If X is an instance of a class for
  16. which printOn: has been provided, then the value of X as defined by the
  17. printOn: method can be displayed on Transcript by
  18.  
  19.   Transcript print: X; endEntry.
  20.  
  21. but as indicated above, the format is not quite what is normally desired.
  22.  
  23.  
  24. 3) The method printString is predefined for many predefined nonString
  25. classes.  It returns a string representation of its receiver that is
  26. appropriate for printing.  (Note that the reason for the name "printString"
  27. is that it returns a string for printing, not that it prints a string.)
  28. Thus, for example,
  29.  
  30.    Transcript show: (17 printString); cr.
  31.  
  32. causes "17" (without quotes) to be printed on the transcript.  To be
  33. consistent with the predefined methods, it is often a good idea to
  34. define a printString method for user-defined classes.
  35.  
  36.  
  37. 4) The withCRs method for instances of String returns the string obtained
  38. by replacing each of the backslash characters (\) of the target string
  39. (receiver of the withCRs message) by a carriage-return character.  For
  40. example, if s is a string, then the value of
  41.  
  42.    s withCRs
  43.  
  44. is the value of s with all '\' characters replaced by a CR character.
  45. In building a string for a printString method, it is convenient to
  46. initially use backslash characters where a CR is desired, and then use
  47. withCRs to convert all the backslash characters to CRs as the last step.
  48.  
  49.  
  50.  
  51. Some differences between VW Smalltalk and GNU Smalltalk:
  52.  
  53. (Each of the following applies to VW Smalltalk.)
  54.  
  55. 1) The nl method in GNU Smalltalk is cr in VisualWorks.
  56.  
  57. 2) A string parameter (not nil) is required for the category: component
  58. of a class definition.
  59.  
  60. 3) Global variable names must begin with an upper-case letter.
  61.  
  62. 4) There is no printNl.
  63.  
  64. 5) !! is considered to be a single symbol. (Use ! ! instead.)
  65.