home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12363 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  2.7 KB

  1. Path: sparky!uunet!usc!elroy.jpl.nasa.gov!swrinde!mips!mips!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  2. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Tagged Pointers
  5. Message-ID: <1992Aug14.234242.8418@ucc.su.OZ.AU>
  6. Date: 14 Aug 92 23:42:42 GMT
  7. References: <1992Aug13.082618.18274@ucc.su.OZ.AU> <1992Aug13.173401.14944@fcom.cc.utah.edu>
  8. Sender: news@ucc.su.OZ.AU
  9. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  10. Lines: 53
  11. Nntp-Posting-Host: extro.ucc.su.oz.au
  12.  
  13. In article <1992Aug13.173401.14944@fcom.cc.utah.edu> swillden@news.ccutah.edu (Shawn Willden) writes:
  14. >maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  15. >
  16. >: >    2)    Tighten the relationship between tagged pointers and 
  17. >: >        tagged unions.  i.e. dereferencing a tagged pointer in
  18. >: >        a context where a tagged union of like types is expected
  19. >: >        yields a tagged union and taking the address of a tagged
  20. >: >        union yields a tagged pointer.  Then foo could be declared
  21. >: >        as taking a reference to a tagged union and foo(*r) would
  22. >: >        be valid.  I think there are some things wrong with this 
  23. >: >        idea, though I haven't thought it out.
  24. >: 
  25. >:     Pointer to tagged unions != tagged pointer. Have to think
  26. >: about it.
  27. >
  28. >That's what I understood from your previous posts (TU*!=TP) and I was
  29. >suggesting that maybe there is a good argument for making this so.
  30. >What are the arguments against it?
  31. >
  32.  
  33.     There's not so much an argument against it as a simple fact
  34. that th're different. The tagged pointer has the tag in the pointer
  35. (conceptually at least). It is a pointer that can point to one
  36. of several types.
  37.  
  38.     A tagged union has the tag in the union.  It is an object
  39. of one of several types.  A pointer to
  40. a tagged union is an *ordinary* pointer.
  41.  
  42.     Tagged pointers are a special case of tagged unions.
  43. You can of course have a pointer to a tagged pointer, etc.
  44. You wouldnt want that to be a tagged pointer would you?
  45. Or perhaps you would?
  46.  
  47.     It all depends on whether tagged pointers are a genuine
  48. type or not. If it is, all the above things must be distinct.
  49. If not (I suggested not in my post) then maybe we can make
  50. a pointer to a tagged union work as if it were a tagged
  51. pointer. This would homogenise the interface. More work
  52. for the compiler, less for the programmmer. Less control
  53. for the programmer too.
  54.  
  55.     So the issue is whether a tagged pointer is a proper type
  56. or just a sort of syntactic sugaring that supports a new 
  57. mechanism for genericity. My thinking was the latter.
  58.  
  59.     Any comments?
  60.  
  61. -- 
  62. ;----------------------------------------------------------------------
  63.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  64.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  65. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  66.