home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / pascal / 8514 < prev    next >
Encoding:
Text File  |  1993-01-25  |  2.2 KB  |  45 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!mcsun!news.funet.fi!funic!nntp.hut.fi!nntp!jkorpela
  3. From: jkorpela@snakemail.hut.fi (Jukka Korpela)
  4. Subject: Re: Variant records
  5. In-Reply-To: dmurdoch@mast.queensu.ca's message of Sat, 23 Jan 1993 20:57:06 GMT
  6. Message-ID: <JKORPELA.93Jan25124537@lk-hp-10.hut.fi>
  7. Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
  8. Nntp-Posting-Host: lk-hp-10.hut.fi
  9. Organization: Helsinki University of Technology, Finland
  10. References: <1993Jan23.140159.10176@wariat.org> <dmurdoch.334.727822626@mast.queensu.ca>
  11. Date: 25 Jan 93 10:45:37 GMT
  12. Lines: 31
  13.  
  14. In article <dmurdoch.334.727822626@mast.queensu.ca> dmurdoch@mast.queensu.ca (Duncan Murdoch) writes:
  15.  
  16.    I'm not sure if standard Pascal 
  17.    forces you to declare a tag field (e.g. "case Choice:Boolean of ..") and
  18.    then makes sure that your references are consistent with the value there, 
  19.    but TP certainly doesn't.
  20.  
  21. I'm sure it doesn't. In the original Wirth's Pascal and in standard Pascal
  22. and, as far as I know, in all Pascal dialects (if they support variant
  23. records at all, of course), a variant can be declared with or without
  24. the tag field identifier.
  25.  
  26. Even if a variant record is declared with a tag field identifier, there is
  27. (in general) no guarantee that inconsistent references to fields will be
  28. trapped. An implementation may or may not provide runtime checks for this,
  29. just as it may or may not perform runtime checks for array indexes
  30. (although it is in practise more common to provide index checks than
  31. variant access checks). The situation may dependent on the settings of
  32. compile-time switches. The standard only requires that the behaviour of
  33. an implementation in this respect be documented (e.g. by stating that
  34. variant access errors are not detected).
  35.  
  36. Moreover, if a variant record is declared _without_ a tag field identifier,
  37. an implementation may perform runtime checks against inconsistent references
  38. (probably by inserting an invisible tag field and implicitly assigning
  39. suitable values to it when the variant is changed). This, of course,
  40. is most a theoretical remark.
  41.  
  42. * Jukka "Yucca" Korpela, Manager of User Support
  43. * Helsinki University of Technology (HUT) Computing Centre, Finland
  44. * Internet mail address: Jukka.Korpela@hut.fi
  45.