Newsgroups: comp.lang.dylan,comp.lang.lisp,comp.lang.java
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!nntp.sei.cmu.edu!news.psc.edu!hudson.lm.com!news.math.psu.edu!news.cac.psu.edu!howland.reston.ans.net!newsfeed.internetmci.com!in2.uu.net!world!moresys
From: moresys@world.std.com (MORE Systems)
Subject: Re: Garbage collection cost (was Re: Parenthesized syntax challenge)
In-Reply-To: hbaker@netcom.com's message of Wed, 1 Nov 1995 01:15:35 GMT
Message-ID: <MORESYS.95Oct31213722@world.std.com>
Sender: moresys@world.std.com (MORE Systems)
Organization: The World Public Access UNIX, Brookline, MA
References: <44aa9a$j5h@miso.cs.uq.edu.au> <LUDEMANN.95Oct6140930@expernet26.expernet.com>
	<DGApp8.J41@undergrad.math.uwaterloo.ca>
	<MAD.95Oct13123618@tanzanite.math.keio.ac.jp>
	<45ksdk$7gr@jive.cs.utexas.edu> <DGJp8o.7nF@Cadence.COM>
	<MAD.95Oct18040436@tanzanite.math.keio.ac.jp>
	<hbaker-1710952127200001@10.0.2.15> <46jb8v$sm8@news.parc.xerox.com>
	<hbaker-2510951016220001@10.0.2.15> <46rkuv$jh8@news.parc.xerox.com>
	<hbaker-2810950832030001@10.0.2.15> <474fku$mej@news.parc.xerox.com>
	<hbaker-3110951715350001@10.0.2.15>
Date: Wed, 1 Nov 1995 02:37:22 GMT
Lines: 16
Xref: glinda.oz.cs.cmu.edu comp.lang.dylan:5773 comp.lang.lisp:19805 comp.lang.java:3377

In article <hbaker-3110951715350001@10.0.2.15> hbaker@netcom.com (Henry Baker) writes:
   C should never allow assignments of union types; they should only
   allow assignments of the members.  Not only does this keep the compiler
   from getting confused, it also keeps the _programmer_ from getting confused.

This is not quite true. A variable of a union type can be assigned a
value of the same union type, which copies the memory verbatim between
the two unions. If you meant to say that you cannot safely assign a
value to a member of a union by assigning the value directly to the
union, that is correct.

I find that it helps to not focus on the fact that the members of a
union overlap in memory. They do, but there is no safe, portable way
to take advantage of the fact. Just think of them as structs with seperate
slots for each member, but only room for one member at a time, and
all the safety rules suddenly make sense.
