home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!sun-barr!cs.utexas.edu!usc!sol.ctr.columbia.edu!eff!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 19:50:49 GMT
- Message-ID: <ART.92Sep12140732@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>
- <ART.92Sep11131535@world.std.com>
- <dmurdoch.151.716241049@mast.queensu.ca>
- Date: Sat, 12 Sep 1992 19:07:32 GMT
- Lines: 37
-
- In article <dmurdoch.151.716241049@mast.queensu.ca> dmurdoch@mast.queensu.ca (Duncan Murdoch) writes:
-
- In article <ART.92Sep11131535@world.std.com> art@world.std.com (Al Thompson) writes:
- > 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.
-
- No, I think you missed the point. You said (and repeat below) that you *do*
- put the parameter list in the implementation section, but in a comment.
- What I'm saying is that you're much better off putting it in as code, so
- that the compiler can check that you got it right.
-
- But how would you get it "wrong"? Presumably you're using an editor that
- allows you to cut and paste. This should ensure you get it right.
- In a sense, this is exactly the way forward declared procedures work in
- standard Pascal.
-
- >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.
-
- That sounds like a crazy thing to do. Why not let the compiler see it
- twice? It's free insurance against mistakes.
-
- How? What mistakes? In the body of the procedure the paramters are just
- another bunch of local variables. If you refer to a variable not
- mentioned in the heading and not declared as a local or global you will
- get a variable undefined error message. If the variable is misused, e.g.
- treating a var parameter as a value parameter, the compiler won't
- complain a bit.
-
-