home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!elroy.jpl.nasa.gov!swrinde!mips!mips!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
- From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
- Newsgroups: comp.lang.c++
- Subject: Re: Tagged Pointers
- Message-ID: <1992Aug14.234242.8418@ucc.su.OZ.AU>
- Date: 14 Aug 92 23:42:42 GMT
- References: <1992Aug13.082618.18274@ucc.su.OZ.AU> <1992Aug13.173401.14944@fcom.cc.utah.edu>
- Sender: news@ucc.su.OZ.AU
- Organization: MAXTAL P/L C/- University Computing Centre, Sydney
- Lines: 53
- Nntp-Posting-Host: extro.ucc.su.oz.au
-
- In article <1992Aug13.173401.14944@fcom.cc.utah.edu> swillden@news.ccutah.edu (Shawn Willden) writes:
- >maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- >
- >: > 2) Tighten the relationship between tagged pointers and
- >: > tagged unions. i.e. dereferencing a tagged pointer in
- >: > a context where a tagged union of like types is expected
- >: > yields a tagged union and taking the address of a tagged
- >: > union yields a tagged pointer. Then foo could be declared
- >: > as taking a reference to a tagged union and foo(*r) would
- >: > be valid. I think there are some things wrong with this
- >: > idea, though I haven't thought it out.
- >:
- >: Pointer to tagged unions != tagged pointer. Have to think
- >: about it.
- >
- >That's what I understood from your previous posts (TU*!=TP) and I was
- >suggesting that maybe there is a good argument for making this so.
- >What are the arguments against it?
- >
-
- There's not so much an argument against it as a simple fact
- that th're different. The tagged pointer has the tag in the pointer
- (conceptually at least). It is a pointer that can point to one
- of several types.
-
- A tagged union has the tag in the union. It is an object
- of one of several types. A pointer to
- a tagged union is an *ordinary* pointer.
-
- Tagged pointers are a special case of tagged unions.
- You can of course have a pointer to a tagged pointer, etc.
- You wouldnt want that to be a tagged pointer would you?
- Or perhaps you would?
-
- It all depends on whether tagged pointers are a genuine
- type or not. If it is, all the above things must be distinct.
- If not (I suggested not in my post) then maybe we can make
- a pointer to a tagged union work as if it were a tagged
- pointer. This would homogenise the interface. More work
- for the compiler, less for the programmmer. Less control
- for the programmer too.
-
- So the issue is whether a tagged pointer is a proper type
- or just a sort of syntactic sugaring that supports a new
- mechanism for genericity. My thinking was the latter.
-
- Any comments?
-
- --
- ;----------------------------------------------------------------------
- JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
-