[642] in java-interest

home help back first fref pref prev next nref lref last post

ClassLoader comments, plus wobbly thoughts

daemon@ATHENA.MIT.EDU (Simon Spero)
Mon Jul 10 18:02:47 1995

Date: Sun, 9 Jul 1995 22:02:17 -0700 (PDT)
From: Simon Spero <ses@tipper.oit.unc.edu>
To: java-interest@java.Eng.Sun.COM

  Would it be possible to have a default loadClass method that just did 
the search though classPath? This is the default case, and would make 
writing sub-classes much easier. I need to modify the loader to keep a 
list of all implementors of a particular interface. Much of the code can 
be stolen from the URL loader, but it really belongs in the base class. 

Also, whilst we're talking about the WWW, has anybody given any thoughts 
to adding some sort of union type to java? At the moment the only way I 
can see of getting the same functionality is through the use of 
sub-classing and interfaces- e.g.

struct {
	union {
		int a;
		int b; 
		String s;
	} u;
	int tag;
} a_union;

becomes

class anInteger {
	public int a=0;
}
class aString {
	public String s=null;
}
interface a_union {}
class a_union_a extends anInteger implements a_union {} 
class a_union_b extends anInteger implements a_union {}
class a_union_c extends aString  implements a_union {}	

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

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post