[655] in java-interest
Re: Unions
daemon@ATHENA.MIT.EDU (Neil Galarneau)
Wed Jul 12 00:24:18 1995
Date: Tue, 11 Jul 95 16:30:41 EDT
From: neil@bedford.progress.COM (Neil Galarneau)
To: java-interest@java.sun.com
jpayne@starwave.com (Jonathan Payne) says:
I don't think this is cheating.
> This is pretty ugly; anybody got any other sugestions? Of course,
> it's easy to wimp out of the typespace altogether -
>
> class a_union {
> public int tag;
> Object item;
> };
>
> - but this is cheating.
>
> Simon
It is certainly a lot less helpful than the C union.
The C union had the advantage of type checking. His example only allowed
for the union to hold ints and strings. Class a_union allows every object
in the world to be in the union.
Neil
neil@progress.com
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com