home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / pascal / 5338 < prev    next >
Encoding:
Text File  |  1992-09-11  |  2.4 KB  |  49 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!world!art
  3. From: art@world.std.com (Al Thompson)
  4. Subject: Re: TP units question
  5. In-Reply-To: dmurdoch@mast.queensu.ca's message of Fri, 11 Sep 1992 01:58:55 GMT
  6. Message-ID: <ART.92Sep11131535@world.std.com>
  7. Sender: art@world.std.com (Al Thompson)
  8. Organization: The World Public Access UNIX, Brookline, MA
  9. References: <1992Sep4.141203.28370@news.columbia.edu> <ART.92Sep10133100@world.std.com>
  10.     <dmurdoch.69.716176734@mast.queensu.ca>
  11. Date: Fri, 11 Sep 1992 18:15:35 GMT
  12. Lines: 35
  13.  
  14. In article <dmurdoch.69.716176734@mast.queensu.ca> dmurdoch@mast.queensu.ca (Duncan Murdoch) writes:
  15.  
  16.    In article <ART.92Sep10133100@world.std.com> art@world.std.com (Al Thompson) writes:
  17.    >
  18.    >No you don't.  The only place the parameter list must appear is the
  19.    >interface section.  The occurence of the parameter list in the
  20.    >implementation section is optional in TP and not permitted in Extended
  21.    >Standard Pascal.  I usually include the parameter list inside a comment
  22.    >in the implementation section.  This serves as a reminder as to what the
  23.    >parameters are without requiring my going back and forth between the
  24.    >interface and implementations, a real pain in a large program.These
  25.    >remarks of course only apply to exported procedures.
  26.  
  27.    That sounds like a bad flaw in the Extended Standard.  Without the compiler 
  28.    checking up on you, how do you know that the parameter list you put in the 
  29.    implementation section is really correct?  
  30.  
  31. You miss the point.  You are not supposed to put the parameter list in
  32. the implementation section.  Therefore it will be neither correct nor
  33. incorrect.  It just doesn't appear.  In TP this is optional.
  34.  
  35.    There are some differences that compile equally well either way, but 
  36.    lead to logic errors if you get them wrong:  For instance, your comment may 
  37.    say a parameter is passed by value.  If the true declaration says that it's 
  38.    passed by reference (a var parameter), then you may be modifying the 
  39.    original when you think you've got a copy to work on.
  40.  
  41.    I think the TP design is better here.
  42.  
  43. But in TP its optional.  In TP I never include the parameter list in the
  44. implementation section.  What I do is write the procedure and then using
  45. my ever helpful emacs copy the procedure heading to the interface
  46. section.  After that's done I go back to the implementation and comment
  47. out the parameter list.
  48.  
  49.