home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsc!cbfsb!att-out!oucsboss!oucsace!tswingle
- From: tswingle@oucsace.cs.ohiou.edu (Tom Swingle)
- Newsgroups: comp.lang.pascal
- Subject: Re: procedural types -- a bug in TP?
- Message-ID: <1992Sep3.020931.3079@oucsace.cs.ohiou.edu>
- Date: 3 Sep 92 02:09:31 GMT
- References: <1992Aug28.154106.15275@news.columbia.edu> <mwodrich.11.715425602@cs1.uct.ac.za>
- Organization: Ohio University CS Dept,. Athens
- Lines: 52
-
- >In article <1992Aug28.154106.15275@news.columbia.edu> stone@cunixb.cc.columbia.edu (Glenn Stone) writes:
- >>This seems to dumb, I'm sure I'm missing something right under my nose.
- >>But anyway:
-
- >>I want to use a procedural type but my compiler (TP 5.5) objects. So
- >>I copied the example right out of the manual (Ref Guide 5.0, p. 85 --
- >>I've paraphrased it a bit):
- >>------------------------------------------------
- >>type
- >> proc = procedure (var x,y : integer);
-
- >>var
- >> p : proc;
-
- >>{F+}
- ^^^^
-
- >>procedure swap (a,b : integer);
- >> begin
- >> end;
- >>{F-}
- ^^^^
-
- >>begin
- >>p := swap;
- >>end.
- >>------------------------------------------
-
- >>The compiler stops on the "p := swap" line and says
-
- >>Error 143: Invalid procedure or function reference
-
- >>Is this a bug, am I making some colossally stupid mistake, or am I in
- >>the Twilight Zone?
-
- You left the "$" out of your compiler directives. The online help says that
- procedures must be compiled as far procedures to be assigned to procedural
- variables. You were trying to write directives, but they were interpreted as
- comments because of the omitted "$"s.
-
- BTW, this was not a stupid question, this had me thrown for a while, as I'm
- sure it did many others.
-
- It was probably a bad idea to make compiler directives so much like comments,
- because of such hard-to-track errors such as this one that it can produce, but
- it's too late to complain about that now. Everyone will just have to live with
- it like it is.
- --
- "The problem you are experiencing is | "To be sure of hitting the target,
- not with the network nor with the | shoot first and, whatever you hit,
- station. Please adjust your set." | call it the target."
- More ramblings from: tswingle@oucsace.cs.ohiou.edu/tswingle@bigbird.cs.ohiou.edu
-