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