home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / pascal / 5177 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  2.2 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsc!cbfsb!att-out!oucsboss!oucsace!tswingle
  2. From: tswingle@oucsace.cs.ohiou.edu (Tom Swingle)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: procedural types -- a bug in TP?
  5. Message-ID: <1992Sep3.020931.3079@oucsace.cs.ohiou.edu>
  6. Date: 3 Sep 92 02:09:31 GMT
  7. References: <1992Aug28.154106.15275@news.columbia.edu> <mwodrich.11.715425602@cs1.uct.ac.za>
  8. Organization: Ohio University CS Dept,. Athens
  9. Lines: 52
  10.  
  11. >In article <1992Aug28.154106.15275@news.columbia.edu> stone@cunixb.cc.columbia.edu (Glenn Stone) writes:
  12. >>This seems to dumb, I'm sure I'm missing something right under my nose.  
  13. >>But anyway:
  14.  
  15. >>I want to use a procedural type but my compiler (TP 5.5) objects.  So
  16. >>I copied the example right out of the manual (Ref Guide 5.0, p. 85 --
  17. >>I've paraphrased it a bit):
  18. >>------------------------------------------------
  19. >>type
  20. >>   proc = procedure (var x,y : integer);
  21.  
  22. >>var
  23. >>   p : proc;
  24.  
  25. >>{F+}
  26.   ^^^^
  27.  
  28. >>procedure swap (a,b : integer);
  29. >>   begin
  30. >>   end;
  31. >>{F-}
  32.   ^^^^
  33.  
  34. >>begin
  35. >>p := swap;
  36. >>end.
  37. >>------------------------------------------
  38.  
  39. >>The compiler stops on the "p := swap" line and says
  40.  
  41. >>Error 143: Invalid procedure or function reference
  42.  
  43. >>Is this a bug, am I making some colossally stupid mistake, or am I in
  44. >>the Twilight Zone?
  45.  
  46. You left the "$" out of your compiler directives.  The online help says that
  47. procedures must be compiled as far procedures to be assigned to procedural
  48. variables.  You were trying to write directives, but they were interpreted as
  49. comments because of the omitted "$"s.  
  50.  
  51. BTW, this was not a stupid question, this had me thrown for a while, as I'm
  52. sure it did many others.
  53.  
  54. It was probably a bad idea to make compiler directives so much like comments,
  55. because of such hard-to-track errors such as this one that it can produce, but
  56. it's too late to complain about that now.  Everyone will just have to live with
  57. it like it is.
  58. -- 
  59. "The problem you are experiencing is  |  "To be sure of hitting the target, 
  60. not with the network nor with the     |  shoot first and, whatever you hit, 
  61. station.  Please adjust your set."    |  call it the target." 
  62. More ramblings from: tswingle@oucsace.cs.ohiou.edu/tswingle@bigbird.cs.ohiou.edu
  63.